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

    I am trying to use the @INHERIT as the default value of a TV to set categories on documents.

    So far I have the following:

    1) Ditto call:
    [!Ditto? &parents=`52` &depth=`0` &dateSource=`createdon` &dateFormat=`%B, %Y` &orderBy=`createdon DESC` &display=`1` &start=`0` &filter=`isfolder,1,2` &tpl=`Ditto_Latest_Articles_tpl`!]


    2) Ditto template:
    <a href="[~[+id+]~]"><img src="[+articlethumbnail+]" alt="[+longtitle+]" /></a>
    <h3><a href="[~[+id+]~]" title="[+longtitle+]">[+title:character_limit=`39`+]</a></h3>
    <p class="artdate">[+articlecategory+] | [+date+]</p>
    <p>[+introtext:character_limit=`132`+]</p>
    <p><a href="[~[+id+]~]" title="Read [+title+]">Read more</a></p>


    The [+articlecategory+] is the TV that I want to use to display the category below the title. However, it does not seem to be inheriting the value of the parent.

    I have the following folder structure:

    Articles
    >>Category
    >>>Year
    >>>>Article

    After setting up the TV with a default value of @INHERIT, I set a value manually on the Category, expecting the Article to inherit it - but it is not working. If I set a fixed default value, it works fine.

    Thanks for your help!
    Matt
      • 36416
      • 589 Posts
      Quote from: mtheuma at Jun 02, 2009, 06:19 AM

      After setting up the TV with a default value of @INHERIT, I set a value manually on the Category, expecting the Article to inherit it - but it is not working. If I set a fixed default value, it works fine.

      Try with @INHERITED ... wink
        • 20557
        • 43 Posts
        Thanks for the quick reply.

        No luck I’m afraid, maybe I’m doing something very wrong? Using @INHERITED as the default makes the value of the TV "ED" - the end INHERITED I guess.
          • 36416
          • 589 Posts
          Quote from: mtheuma at Jun 02, 2009, 07:33 AM

          No luck I’m afraid, maybe I’m doing something very wrong? Using @INHERITED as the default makes the value of the TV "ED" - the end INHERITED I guess.

          Are you using richtext field to enter value @INHERITED ? Is there valid non-inherited value inside any of ancestors?
            • 20557
            • 43 Posts
            The input type is set to text and one of the parents has a value set.

            If I add [*articlecategory*] within the document it outputs on the page correctly - so it seems to be a problem using it in-conjunction with Ditto or something...
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I’m not sure if Ditto sets an inherited TV value into a placeholder. What happens if you use the TV tags instead of placeholder tags?
                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
                • 20557
                • 43 Posts
                Quote from: sottwell at Jun 02, 2009, 08:50 AM

                I’m not sure if Ditto sets an inherited TV value into a placeholder. What happens if you use the TV tags instead of placeholder tags?

                It returns the value for the current document, rather than the one being fetched by Ditto...

                If I replace [+articlecategory+] with:

                [[GetField? &docid=`[+id+]` &field=`articlecategory`]]


                It works just fine... so I’ll use that solution for now. Is the problem that Ditto can’t deal with inherited TV values?
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  I’ll have to look at the code, but getting inherited TV values is a complex bit of code, and I’m not sure if Ditto does that or not.
                    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