We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23491 ☆ A M B ☆
    • 1,056 Posts
    Quote from: boblin at Dec 20, 2007, 06:01 AM

    How to avoid cases where i have to use snippet with parameters inside Phx call? The only way i found is to create chunk with such call, but it is against good programing practices imho (-;

    [+phx:input=`[[YourSnippet?&param1=`value1`]]`:is=`...`:then=`...`+]
    
      Mike Reid - www.pixelchutes.com
      MODx Ambassador / Contributor
      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
      ________________________________
      Where every pixel matters.
      • 18436
      • 135 Posts
      Installed PHx last night to try and get around an irritating Ditto issue only to have all my wayfinder calls that use placeholders die. Here’s an example of what I’ve done:

      [!Wayfinder? &startId=`22`	&level=`2`	&ph=`currentDevs`	&config=`colliers`	!]
      [!Wayfinder? &startId=`23`	&level=`1`	&ph=`pastDevs`		&config=`colliers`	!]
      <ul id="leftNav">
      	<li class="toplevel blue"><a class="toplevel" href="[(site_url)][~1~]">Home</a></li>
      	<li class="toplevel current"><a class="toplevel" href="[(site_url)][~22~]">Current Developments</a>[+currentDevs+]</li>
      	<li class="toplevel past"><a class="toplevel" href="[(site_url)][~23~]">Past Developments</a>[+pastDevs+]</li>
      	<li class="toplevel purple"><a class="toplevel" href="[(site_url)][~10~]">About Colliers</a></li>
      </ul>


      PHx plugin enabled: zero output...
      PHx disabled: menu items are shown...

      Any ideas?
        • 23491 ☆ A M B ☆
        • 1,056 Posts
        Quote from: Marschant at Feb 01, 2008, 08:37 AM

        PHx plugin enabled: zero output...

        Any ideas?

        It’s all a matter of understanding how PHx works. Unfortunately, PHx often conflicts with placeholders created by other snippets as it pre-parses the actual placeholder BEFORE it even gets set in the first place.
          Mike Reid - www.pixelchutes.com
          MODx Ambassador / Contributor
          [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
          ________________________________
          Where every pixel matters.
          • 18436
          • 135 Posts
          Thanks I understand that issue, I’m really hoping that 0.9.7 will address certain shortcomings with what I consider to be the core MODx snippets: Ditto, Wayfinder & PHx... I mentioned in a previous post (http://modxcms.com/forums/index.php/topic,20811.0.html) my misgivings with Wayfinder (no tv filtering support), Ditto (no native tiered output for parents/children) and now PHx (powerful conditionals & modifiers, prevents use of placeholders).

          I’m just getting incredibly frustrated with the limits of each one, MODx is brilliant but has many issues preventing it from being the Numero Uno CMF of choice. Since many projects rely on complex associations, and tv’s are the only way to handle this, I feel there are way too many hoops to jump through when trying to get the three snippets mentioned above to work together.

          Another issue for me and potentially for clients is local => live synchronisation, hence I’m taking the approach of using as many file system resources as possible i.e. snippets, chunks & partials stored in sub-dir of main template, it just seems easier to FTP new files instead of messing around with a DB synch, anyway I’ve wandered off-topic...
            • 17705
            • 501 Posts
            Hi!

            can this be done with phx?

            I have a products section, and some products have more details (more photos, made with a maxigallery in a child of each document),something like this:

            products
            product1
            product2
            product3
            product3details
            product4
            product5
            product5details
            ...and so on

            so, if the product have a child (details) I need a link to it in the non detailed product document...

            is there any way to do it?
            any idea?


            TIA, and sorry for the bad english smiley

            luciano
              • 26876
              • 12 Posts
              Recently, we experienced a problem where [+phx ... +] appeared on the website itself.

              My first thought was about some special characters messing up the parse process. However, this was not the case. It turned out to be related to the size of the parsed variable-values. With chunks and snippets being inserted into the PHx parse process, this can happen quite soon. Took me some time to find the culprit: PHP 5.2, see: http://www.php.net/manual/ref.pcre.php#77790

              In PHP 5.2, a setting was added that controls the behavior of preg_match_all (used in PHx). Solution to the above problem: Increase the value of pcre.backtrack_limit in your PHP config to allow longer strings. If it’s missing you can add it anywhere in your php.ini, like so:

              [Pcre]
              pcre.recursion_limit=100000
              pcre.backtrack_limit=200000 ; Default is 100000

              Hope this helps anyone smiley
                • 23491 ☆ A M B ☆
                • 1,056 Posts
                Quote from: Shadoze at Mar 13, 2008, 09:25 AM

                Recently, we experienced a problem where [+phx ... +] appeared on the website itself.

                [Pcre]
                pcre.recursion_limit=100000
                pcre.backtrack_limit=200000 ; Default is 100000

                Hope this helps anyone smiley

                @Shadoze,

                I have run into this before, and this is great information on how to work-around this in PHP 5.2+ Thank you for posting!
                  Mike Reid - www.pixelchutes.com
                  MODx Ambassador / Contributor
                  [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                  ________________________________
                  Where every pixel matters.
                  • 7923
                  • 4,213 Posts
                  Quote from: luuuciano at Feb 25, 2008, 08:01 AM

                  Hi!

                  can this be done with phx?

                  I have a products section, and some products have more details (more photos, made with a maxigallery in a child of each document),something like this:

                  products
                  product1
                  product2
                  product3
                  product3details
                  product4
                  product5
                  product5details
                  ...and so on

                  so, if the product have a child (details) I need a link to it in the non detailed product document...

                  is there any way to do it?
                  any idea?


                  TIA, and sorry for the bad english smiley

                  luciano

                  Do a simple snippet, eg. (untested)

                  if (!isset($id)) {
                  	return "";
                  } 
                  $childs = $modx->getChildIds($id, 1);
                  if (count($childs) > 0) {
                  	return '<a href="'.$modx->makeUrl($childs[0]).'">More details</a>';
                  }


                  or if you want page title to the link:

                  if (!isset($id)) {
                  	return "";
                  } 
                  $childs = $modx->getChildIds($id, 1);
                  if (count($childs) > 0) {
                  	$doc = $modx->getDocument($childs[0], 'pagetitle', 1); 
                  	if (empty($doc)) {
                  		$doc = $modx->getDocument($childs[0], 'pagetitle', 0);
                  	}
                  	return '<a href="'.$modx->makeUrl($childs[0]).'">'.$doc['pagetitle'].'</a>';
                  }


                  And use it like [!yoursnippet? &id=`[+id+]`!]


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                    • 11784
                    • 4 Posts
                    http://modxcms.com/forums/index.php/topic,7522.msg137596.html#msg137596
                    This same problem also affects Easy Events. When PHx is enabled it effectively prevents the use of Easy Events.

                    Here’s a quote from my template using Easy Events:
                    <div id="ee_miniCalendarContainer">
                        [+miniCalPlaceholder+]
                    </div>
                    <div id="ee_listDetailsContainer">
                        [+listDetailsPlaceholder+]
                    </div>
                    [!EasyEvents_ListMini? &nodes=`71`!]


                    The call for EasyEvents_ListMini snippet is supposed to set the placeholders miniCalPlaceholder and listDetailsPlaceholder but it doesn’t work when PHx is enabled.
                    The same problem should occur if you make a new snippet that does nothing else than sets a placeholder and then try to use that placeholder and the snippet call in your template (Although this isn’t useful anyway but you get the point).
                    Is there a known workaround for this kind of situation?
                      • 32645
                      • 377 Posts
                      How do I get PHx to ask whether a document is a folder, or has other default document attributes?

                      ie:
                      [+phx:if=`isfolder`:isnot=``:then=`FOLDER`+]
                      

                      This discussion is closed to further replies. Keep calm and carry on.