We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7231
    • 4,205 Posts
    I would like to use TVs to create dynamic document titles. This works fine in the site but in the document tree you only see the TV tag which makes it difficult to recognize the document. Is there any way to get the tv to show up in the titles in the doc tree?

    Currently I have several docs with the same title [*someTV*].
      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

      Something is happening here, but you don't know what it is.
      Do you, Mr. Jones? - [bob dylan]
      • 10226
      • 412 Posts
      Instead of using a TV you can indeed use the pre-set fields. I use the Document Description as the Title for my FAQ page... Super easy if I am understanding your issue.

      http://sweetskies.fruitwerks.us/faq.php
        • 7231
        • 4,205 Posts
        Thanks for the reply. I tried that and I get the same issue. It works in the display of the page in the front-end, that part works great with a TV or a DV (document variable). However in the document tree I get:

        [*longtitle*](13)
        [*longtitle*](14)
        [*longtitle*](15)
        [*someTV*](17)
        [*someTV*](21)
        [*someTV*](25)

        In the front end the navigation and page title work fine, just not in the doc tree in the manager. I am guessing that has to do with the info not being parsed, I am guessing that it is straight from the db which would explain why the TVs are not parsed.

        Another thing I noticed is that if I use a TV in the alias field it gets striped and not parsed, so [*someTV*] ends up being recorded as someTV rather than the TV value.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don't know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 10226
          • 412 Posts
          hmm.. have you tried cached vs un-cahced?
            • 7231
            • 4,205 Posts
            I tried both chached and un cached documents and got the same results.
            Not sure how to set un-cached tvs.
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don't know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              The back-end, especially the tree, does not pass through the parser, so TVs, chunks, and snippets are not parsed. You might be able to hack the nodes.php (manager/frames/nodes.php) to get the value of a TV for the given document, but this is mostly legacy code from the days before there were TVs, and the code is pretty ugly. Here is where you’d need to make one change...
                      while(list($id,$pagetitle,$parent,$isfolder,$published,$deleted,$type,$menuindex,$hidemenu,$alias,$contenttype,$privateweb,$privatemgr,$hasAccess) = mysql_fetch_row($result))
                      {
                          $pagetitle = htmlspecialchars($pagetitle);
              

              you could parse this to see if it is a TV ([*...) and if it is, go to the database to get the value of the TV for this document.

                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
                • 7231
                • 4,205 Posts
                I figured that the parser was the issue. I am not secure enough to mess with the code for a client site. I will try to use ManagerManager to rename the default doc variable and not use TVs, this could work if I understand ManagerManager correctly.

                Maybe we could get this feature in the .1 or .2 update, seems that it would be handy.

                Thanks for all the help. smiley
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don't know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 22303 MODX Staff
                  • 10,725 Posts
                  I have a feeling doing so would make the loading of the tree extremely inefficient. Perhaps something in the 0.9.7+ branches can address this though, via a custom caching mechanism and/or some new options for defining what is to be displayed in the tree.