We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    I use the foloing code to make a puldown list that is filled by documents where another tv checkbox is set to yes
    I used it to select 3 (I made 3 tv’s with the same code but differend default selected) info screens on each page that links to that page(will be online soon then I can show you all)

    this is a @SELECT using join:

    @SELECT pagetitle,contentid FROM `modx_site_content` AS c JOIN `modx_site_tmplvar_contentvalues` AS t ON c.id=t.contentid WHERE tmplvarid = 4 AND value = 'yes'
    


    The above gets me all page id’s and pagetitles that have tv with id 4 set to "yes"

    Dimmy
      follow me on twitter: @dimmy01
      • 4310
      • 2,310 Posts
      Nice smiley
        • 12147
        • 182 Posts
        Looking forward to online example!
        grin
          • 3749
          • 24,544 Posts
          Truly impressive Dimmy. smiley
            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
            • 21671
            • 244 Posts
            1 more post Dimmy...you can do it!
              • 4058
              • 17 Posts
              Hi Dimmy,

              I’m just curious on a use for your @select code which I really like a lot. Perhaps, you have already accomplished the below with it?

              I’m trying to create a link based on what is selected, but can’t figure out how to retrieve the pagetitle? The output of the TV is the id for the selected item, but I’m trying to figure out how to set the anchor text based on the ID.

              So, if I choose Product #1 from the select box, which has an ID of 17, how would I get something like <a href="[~17~]">Product #1</a>?

              I hope you might have an answer. I was thinking this may be something possible with PHX?
                • 4172
                • 5,888 Posts
                You can use the getField-snippet to get the fields with &field=`thefield` from other resources. default for &field is pagetitle.


                <a href="[~[*yourTV*]~]">[!getField? &docid=`[*yourTV*]`!]</a>


                or if you want to use it in a ditto-chunk:

                <a href="[~[+yourTV+]~]">[[getField? &docid=`[+yourTV+]`]]</a>
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 7455
                  • 2,204 Posts
                  I used it like Bruno describes it.

                  this is the site where I used it:

                  http://www.qredits.nl/over_qredits/wie_is_qredits.html

                  on all pages you see 3 (or less) circles on the bottom those are set using the select in the tv and then in Ditto I used the getfield stuff.

                  and I update the select a bit so it only get docs with a certain template.

                  @SELECT pagetitle,contentid FROM `modx_site_content` AS c JOIN `modx_site_tmplvar_contentvalues` AS t ON c.id=t.contentid WHERE tmplvarid = 4 AND value = 'ja' AND template = 8
                  



                  Dimmy
                    follow me on twitter: @dimmy01
                    • 4058
                    • 17 Posts
                    Works perfectly. Thanks guys.