We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18338
    • 31 Posts
    I had need of a phx snippet to replace space characters with %20 when feeding images to phpthumb. This one is pretty straightforward, and it may come in handy for someone else:


    Snippet Name: phx:URL_encode_spaces
    Description: Replace space character with %20

    <?php
    $url = str_replace(' ', '%20', $output);
         return $url;
    ?>
      • 25003
      • 9 Posts
      I’m trying to put some social bookmarking links on a MODx site so this would come in very handy.

      How would I call this snippet? I’ve tried adding...

      :url=`[*pagetitle*]`

      ....but that doesn’t seem to work.

      If anyone can help I’d be most grateful. Thanks.

        • 25003
        • 9 Posts
        Ok, I think I found it.

        [*pagetitle:URL_encode_spaces*]

        This came in handy http://wiki.modxcms.com/index.php/PHx#Example:_I_love_MODx