We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26113
    • 88 Posts
    I am working a site where I’d like to pass data from the URL.
    TV’s are great, but I dont want to have to create a page for every scenario -
    Is it possible to write a TV that can take the parameter of a Friendly URL?
    My example calls for looking movie titles by beginning letter.
    I have the alphabet laid out, clicking a letter will display all movies with the letter a.

    I’d like the URL to look like ’/letters/a’ and the a is passed to letters, which the TV can deal with to lookup.

    How can I set this up?
    Thanks
    Rich
      • 26799
      • 177 Posts
      if I understand you correctly you want to filter out pre-created documents using a "query string"...

      You can create a single page to handle all the list logic and use the Ditto snippet to filter your results.
        • 26113
        • 88 Posts
        But how do I setup modx to know letters/a is not another file to lookup
        but really a parameter:

        letters?letter=a
        then I can look up in a table all titles that begin with a.
        that should look like a directory
        letters/a

        Rich
          • 11975
          • 2,542 Posts
          Hi,

          you can add a where clause in ditto call.
          &where=`sc.pagetitle LIKE ’%a’`

          you could write a little snippet to retrieve the $_GET param and then
          &where=`[[getLetterParam]]`

          :-)
            Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
            • 26113
            • 88 Posts
            I follow you on those pieces - I guess I am stumped how to make modx see an on-the-fly directory path as a GET parameter.
              • 26799
              • 177 Posts
              great solution helio.


              You could just create a snippet to parse your url string and get your letter there. I realize this isn’t as simple as a REQUEST var but if SEO for this site merits this kind of thing it’s a pretty simple solution.
                • 22303 MODX Staff
                • 10,725 Posts
                Quote from: sandman at Feb 17, 2007, 02:22 PM

                I follow you on those pieces - I guess I am stumped how to make modx see an on-the-fly directory path as a GET parameter.
                This would require custom rewrite rules to convert whatever parameter you wanted to a path...
                  • 1379
                  • 22 Posts
                  I guess it is possible
                  you have to use the query string functions to get your job done.
                  The simplest of a think you can make over it.

                  Regards
                  Amitav Roy
                  Email: [email protected]
                  Website: http://www.pixelgroups.com
                  Blog: http://design.pixelgroups.com
                    Regards
                    Amitav Roy
                    Web Designer
                    Website: http://www.pixelgroups.com
                    Portal: http://www.creativeporta.com
                    • 26799
                    • 177 Posts
                    This would require custom rewrite rules to convert whatever parameter you wanted to a path...

                    @Open Geek
                    Would this still pass $_GET[’letter’] to the document or abandon the query string on rewrite?
                      • 26113
                      • 88 Posts
                      Quote from: OpenGeek at Feb 17, 2007, 02:40 PM

                      Quote from: sandman at Feb 17, 2007, 02:22 PM

                      I follow you on those pieces - I guess I am stumped how to make modx see an on-the-fly directory path as a GET parameter.
                      This would require custom rewrite rules to convert whatever parameter you wanted to a path...

                      How would I customize:
                      http://ghoulghoul.com/detail?id=48

                      to
                      http://ghoulghoul.com/detail/48


                      I tried to edit the .htaccess already and it messed up how everything was loading - including the manager.
                      Any help here would greaylt be appreciated.