We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19033
    • 892 Posts
    > Dear netProphET

    Thank you for answering my comment.
    I tried TobyL’s mod http://modxcms.com/forums/index.php/topic,14306.msg96738.html#msg96738,
    and it did not do the trick.

    I thank that you gived me valuable information.
    I readed the thread which you showed.
    I think also that my trouble is the same as that.

    I tried TobyL’s hack too.
    But it did not work for me..

    Sincerely yours,
      • 21056
      • 327 Posts
      Quote from: bS at Jun 29, 2007, 11:22 AM

      FYI: using the hack will result in PHX not being recursive.
      The reason phx takes on the placeholders is because it needs to resolve the value when they are nested.


      I haven’t incorporated this hack for this reason. BUT I’ve uploaded a new version (2.1.3) which includes the "get modifier from file" functionality.
        Author: ManagerManager plugin - customise your ModX manager interface

        Rckt - web development, Sheffield, UK
        • 21257 MODX Staff
        • 730 Posts
        Quote from: netProphET at Jul 05, 2007, 10:38 AM

        PHx is prohibiting me from specifying a Chunk name with a TV.
        ex. {{[*right-hand-images*]}}

        It seems to me that 2 problems have surfaced for users of PHx
        - using placeholders as snippet parameters
        - using a template variable as the name of a Chunk

        I would love to see a list of any other similar issues. It feels like there might be others. Are these issues being addressed or do they underscore an incompatibility - in order for PHx to achieve what it does, it makes certain feats of the core MODx parser impossible? If the former is true, I think there should be some sort of official disclaimer within the PHx distribution. Maybe with the rewrite of the core for 0.9.7, this will all go away, so expending energy on it for 0.9.6 is not worthwhile?

        Any thoughts on this are appreciated.
          Mike Schell
          Lead Developer, MODX Cloud
          Email: [email protected]
          GitHub: https://github.com/netProphET/
          Twitter: @mkschell
          • 20751
          • 122 Posts
          Hi,

          When using ditto I’m trying to display a ditto template if the user is logged in and another if a user isn’t logged in. The purpose being that only registered users can view the full document. Here’s what I have which seems to work, but I wondered if anyone who has more experience could tell me if this is the best way to do it and if i’ve done it right:

          [+phx:userinfo=`id`:gt=`0`:then=`
          <h3>[+pagetitle+]</h3>
          <p>[+introtext+]</p>
          <p><a href="[~[+id+]~]">View details</a></p>
          `:else=`
          <h3>[+pagetitle+]</h3>
          <p>[+introtext+]</p>
          <p><a href="[~36~]">Login to view details</a></p>
          `:strip+]


          Document id 36 is a login page.

          Thanks for any input!!

            • 23491 ☆ A M B ☆
            • 1,056 Posts
            Is it possible to leverage Ditto’s pagination placeholders when PHx is enabled? Yes!

            I am using v2.1.3, and PHx gets to my placeholders before Ditto even has a chance sad

            Sadly, http://ditto.modxcms.com/tutorials/phx-and-nested-tags.html doesn’t account for "non-PHx nested placeholders"...

            ditto_pages Chunk:
            <div id="ditto_wrapper">
                <div id="ditto_pages">[+articles_previous+] [+articles_pages+] [+articles_next+]</div>
                <strong>[+articles_total+]</strong> Total Articles<br/>
            </div>
            


            Update:

            The only work-around I was able to get to work was to actually place the chunk & placeholders inside of a snippet:

            <?php
            $html='<div id="ditto_wrapper">
                <div id="ditto_pages">[+articles_previous+] [+articles_pages+] [+articles_next+]</div>
                <strong>[+articles_total+]</strong> Total Articles<br/>
            </div>';
            
            return $html;
            ?>
            


            So, rather than having to store HTML in the snippet, I am going to rewrite it to pull from the chunk I was using before anyway:

            <?php
            return $modx->getChunk( 'ditto_pages' );
            ?>
            


            And that worked! cool

            Now I can keep my code separate, and edit the chunk as I would normally, and PHx behaves nicely with my Ditto placeholders smiley
              Mike Reid - www.pixelchutes.com
              MODx Ambassador / Contributor
              [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
              ________________________________
              Where every pixel matters.
              • 21257 MODX Staff
              • 730 Posts
              Interesting, Pixelchutes. I used the same kind of solution to solve my problem, which had nothing to do with Ditto.
              Problem: with PHx, I became unable to specify a Chunk directly with a TV, like this:
              {{[*right-hand-images*]}}


              Solution: so I wrote a snippet whose job it is to simply return a chunk, essentially like your snippet code. Then, to duplicate the functionality of the call above, I just need to change the call to this:
              [[returnChunk? &chunk=`[*right-hand-images*]`]]


              This might be the basic pattern to solving this general problem introduced by PHx.
                Mike Schell
                Lead Developer, MODX Cloud
                Email: [email protected]
                GitHub: https://github.com/netProphET/
                Twitter: @mkschell
                • 23491 ☆ A M B ☆
                • 1,056 Posts
                Quote from: netProphET at Jul 27, 2007, 10:24 PM


                This might be the basic pattern to solving this general problem introduced by PHx.


                What if PHx used different identifiers (or was able to be custom defined) other than [+ and +]? It would seem anything that NEEDED PHx modifiers/functionality could leverage PHx parser’s identifiers, while regular placeholders used the MODx default ones?

                I know this would solve at least 3 issues I have personally ran into, which involve Ditto, eForm, and your chunk example above...
                  Mike Reid - www.pixelchutes.com
                  MODx Ambassador / Contributor
                  [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                  ________________________________
                  Where every pixel matters.
                  • 25663 MODX Staff
                  • 12,272 Posts
                  Great point Mike. Sounds like a good consideration for a future release.
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 21257 MODX Staff
                    • 730 Posts
                    This is a vote for adding 2 core extenders to PHx.
                    - urlencode
                    - stripslashes
                    I have made my own extender mini-snippets to provide this functionality. They work fine, but they’re just one simple php function, and I’m left thinking that if they were part of the PHx core code, there would be less processing going on.
                    I am using these functions a lot during form processing (along with the already-defined htmlent processor)... I am able to cut a lot of processing code out of my form handling snippets by moving these processors into the template.
                    May this also be considered as PHx functionality is integrated into the 0.9.7 core.
                      Mike Schell
                      Lead Developer, MODX Cloud
                      Email: [email protected]
                      GitHub: https://github.com/netProphET/
                      Twitter: @mkschell
                      • 3743
                      • 42 Posts
                      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 (-;

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