We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22840
    • 1,572 Posts
    Hi All,

    I have a TV assigned to the home page ( id 1 ) that I need to show in the header of every page but I'm having a blond day and can't seem to get it to work.

    The call in the header chunk:

    [[pdoResources?
    		&resources=`1`
    		&tpl=`availability`
    		&includeTVs=`availability`
    		&processTVs`availability`
    		&prepareTVs=`availability`
    		&tvPrefix=``
    	]]


    The availability chunk:

    [[+availability]]


    What have I missed ?

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 22840
      • 1,572 Posts
      Solved it by using pdofield

      [[pdoField?
          		&id=`1`
          		&field=`availability`
      	]]
      • discuss.answer
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Using pdoTools built-in FastField feature:
        [[#1.tv.availability]]
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 22840
          • 1,572 Posts
          Quote from: sottwell at Jan 15, 2016, 08:05 AM
          Using pdoTools built-in FastField feature:
          [[#1.tv.availability]]

          Even better, thanks Susan
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Looking at your code... is this exactly as you had the pdoResources snippet call? Or is the missing = in the &processTVs property a typo only in your post?
            [[pdoResources?
                    &resources=`1`
                    &tpl=`availability`
                    &includeTVs=`availability`
                    &processTVs`availability`
                    &prepareTVs=`availability`
                    &tvPrefix=``
                ]]


            Another thing... I have never yet used the &processTVs or &prepareTVs properties. I don't use output options for TVs, I always format their output myself so those just aren't necessary. I also find it helpful to always add 'Tpl' to my tpl chunk names... availabilityTpl. That helps avoid confusion later, making it clear what each element is for. I probably would have even named the TV availabilityTV for the same reason.

            And I'm pretty sure that you always need a &parents property even if you don't want it. In this particular case, it's a bit awkward since you only want the one field from the one resource, so using pdoResources was a case of severe overkill anyway.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org