We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16879
    • 87 Posts
    Back in the old Jot support thread there was a sub discussion about processing a custom URL field to remove the "http://".

    It concluded with a quote from BS : "I think that such an request is a little out of scope for Jot specific. Your problem is solved by inputting the [+comment.custom.yourUrlField+] into a homemade snippet that does the processing."

    Has anyone written such a snippet?
      • 4195
      • 398 Posts
      Create a PHx custom modifier.

      1. Create a new snippet and name it: phx:striphttp
      2. Paste the following code into the snippet code field

      $output = str_replace('http://','',$output);
      return $output;
      


      now you can use :striphttp in any placeholder you like.
      Example:

      [+comment.custom.yourUrlField:striphttp+]
      
        Armand Pondman
        MODx Coding Team
        :: Jot :: PHx
        • 16879
        • 87 Posts
        Thanks BS - that works: I can now strip off any http:// that commenters put on and add it back on to every URL in the template. Good stuff

        Whilst I was pondering I had a detour into using &validate to head the problem off at the pass but I can’t seem to get it to work even with a single string. This is my simple call :

        [[Jot? &subscribe=`1` &validate=`email:Email address not valid. Sort it out.:email` &customfields=`name,website,email` ]]

        but what I was intending to use as a multiple was:

        [[Jot? &subscribe=`1` &validate=`email:Email address not valid. Sort it out.:email,website:The website URL is not correct...:^http:\/\/(\w*)\.([\-\+a-z0-9]*)\.(\w*),name:A name is required` &customfields=`name,website,email` ]]

        I got the regex elsewhere.

        Am I not seeing the wood for the trees here? I’d still like to use the validation for other fields.
          • 4195
          • 398 Posts
          does your simple call work?
            Armand Pondman
            MODx Coding Team
            :: Jot :: PHx
            • 16879
            • 87 Posts
            Nope - I just get the default message for no content.

            Everything else works fine though - great snippet, I was considering using something like Wordpress earlier this week because I wasn’t happy with the usercomments system I’d been playing with. Jot has given me all the functionality I need (trackback would be nice tho!)
              • 4195
              • 398 Posts
              can you confirm that in the manager the Jot snippet code is in fact holding &validate as a SET value?
              (are you using 1.0.1 btw?)
                Armand Pondman
                MODx Coding Team
                :: Jot :: PHx
                • 16879
                • 87 Posts
                I’m using 1.0 beta8 - just upgraded to MODX 9.5 yesterday so I haven’t upgraded snippets yet - will this help?

                "can you confirm that in the manager the Jot snippet code is in fact holding &validate as a SET value?" - not quite sure what you mean and how I would do this - sorry , I’m more designer than coder...
                  • 4195
                  • 398 Posts
                  yes ofcourse... validate wasn’t available in beta 8 smiley

                  always be sure to update Jot to the latest version:

                  - download Jot 1.0.1 from the repository
                  - Check the install notes (very straightforward) and set it up.
                    Armand Pondman
                    MODx Coding Team
                    :: Jot :: PHx
                    • 16879
                    • 87 Posts
                    That’ll explain it then! OK - many thanks for your help. Once again - great piece of work!