We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32645
    • 377 Posts
    I have set up a template variable called:


    "tv_youtube" (Link) -> Contains a hyperlink reference to a youtube clip

    I have a custom modifier which takes the output and strips out the ?watch part so I can use it to create a Flash player.

    However, the custom modifier does not work. At all.

    PHx is on, and the cache is cleared for both document and website.

    I’ve done a custom modifier where I output the incoming input and do a simple test, neither of which work.

    Can someone verify the solution to why these custom modifier tests do not output anything:

    <p>
    Youtube raw: [+tv_youtube+] -- This is fine and prints the value of the template variable<br />
    Test: [+tv_youtube:test+] -- Nothing is returned <br />
    Youtube urlencode:[+tv_youtube:urlencode+] -- Nothing is returned <br />
    Get youtube: [+tv_youtube:get_youtube+] -- Nothing is returned.
    </p>
    


    The modifiers:

    // phx:test
    // This does even get outputted. The value of input and output are null
    print 'Input: ' . $input;
    print 'Output: '. $output;
    


    // phx:urlencode
    // Nothing s returned
    $output = urlencode($output);
    return ($output);
    


    // phx:get_youtube
    // It should do a print_r of all vars, but it doesn't do anything
    $url = $output;
    $parsed_url = parse_url($url);
    parse_str($parsed_url[query], $parsed_query);
    print_r($parsed_query);
    //return ($parsed_query['v']);
    
      • 32645
      • 377 Posts
      I have tried both [*tv_youtube:get_youtube*] and [+tv_youtube:get_youtube+], neither of which return anything.

      I have tried calling Ditto cached and non-cached, again - nothing is returned.

      I have tried clearing the cache on the document as well as the parent calling the document via Ditto -- again, nothing is returned.

      Is there a quick test I can try to see if PHX custom modifiers are working, which then I can customise for my own needs?

      Thanks.
        • 4310
        • 2,310 Posts
        If your custom modifier is named test, have you tried in your Ditto template :
        [+phx:test=`[+tv_youtube+]`+]

        That’s how I’ve done it in the past smiley
          • 32645
          • 377 Posts
          I tried:

          [+phx:test=`[+tv_youtube+]`+]
          


          And I got back:


          &_PHX_INTERNAL_&
          &_PHX_INTERNAL_&

          The code for test is:

          // phx:test
          print $input . '<br />';
          print $output .'<br />';
          


          This is getting really annoying.

          All I want is to get phx custom modifiers to work.
            • 4310
            • 2,310 Posts
            I’m not sure but you may have to explicitly return your variable :
            $myVar = $output;
            // do something to $myVar
            return $myVar ;
              • 32645
              • 377 Posts
              Hi there

              I reinstalled modx locally with PHX enabled and did a very basic test with no other furls, etc, all the phx custom modifiers work fine, including the one’s I wrote which I use to grab Youtube URL references.

              So,...

              I know that it works, and that PHx custom modifiers work, but why do not they work online.

              I’ve tried getting rid of my htaccess file to see if this caused the problem, but alas this did not solve the problem.

              Thanks.
                • 32645
                • 377 Posts
                I figured out what the problem was! UGH!

                In my ditto call, I did this:

                [[Ditto? &debug=1` &startId=`[*id*]` &hideFolders=`1` &depth=`0` &showInMenuOnly=`1` &sortBy=`createdon` &sortDir=`DESC` &paginateAlwaysShowLinks=`1` &pagesPerPage=`5` &paginate=`1` &summarize=`3`  &tplPaginatePage=`pageSplitter` &tplPaginateCurrentPage=`currentPageSplitter` &phx=`0` &extenders=`summary` &tpl=`Blog_chunk` ]]
                


                The problem was that I put &phx=`0` -- this switched off my PHX, and when I removed this tag, or changed it to &phx=`1` the phx returns were there!

                I am going to double check some of the TV’s to ensure that the PHX is returned what I am expecting, but it appears to have been resolved.
                  • 4310
                  • 2,310 Posts
                  Glad you worked it out laugh
                    • 3749
                    • 24,544 Posts
                    Would you add[SOLVED] to the subject line, so others don’t think PHX is broken. wink
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 32645
                      • 377 Posts
                      Quote from: BobRay at Oct 15, 2009, 05:42 PM

                      Would you add[SOLVED] to the subject line, so others don’t think PHX is broken. wink

                      Done