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

    Is this possible : displaying either the longtitles or the menu titles rather than the page titles for the document tree in the backend ?

    Thanks.


    Why I need this:
    In my document tree are some branches with childs that all use the same page title.
    I use longtitle to write a subtitle for each child, but this is for the frontend.
    Unfortunately, in my case the document tree in the backend always display the page title, so I hardly can find which document has which content when looking at the backend.
      • 3749
      • 24,544 Posts
      Could you reverse those?  IOW, put the subtitle in the pagetitle and the common name in the longtitle (or in a TV), then use a template for those pages that shows them as you want them to appear.  That would be easier than hacking the core code to modify the tree. If you hack the code, your changes will be overwritten when you upgrade to a new version of MODx (unless you can create a plugin that modifies the tree display).
        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
        • 15001
        • 697 Posts
        Could you reverse those? IOW, put the subtitle in the pagetitle and the common name in the longtitle (or in a TV)
        Of course I can, but as I don’t plan to update MODx for that site, hacking the core would not be a problem.
        This is just for easier work in the backend.
          • 4041
          • 788 Posts
          In that case, the place I think you need to modify is in "manager/frames/nodes.php" (note the file I looked at was 0962rc2) and it seems like if you just changed the database query in one spot, that would be sufficient.

          my file shows the query on line 98:
          $sql = "SELECT DISTINCT sc.id, pagetitle, parent, isfolder,(rest of query...)

          I think changing pagetitle to longtitle in the above query would work as expected, at least worth a try smiley

          * note that this is untested
            xforum
            http://frsbuilders.net (under construction) forum for evolution
            • 15001
            • 697 Posts
            Hi Breezer,

            Thanks. Unfortunately it doesn’t work.

            (I also tried to replace below all $pagetitle variables by $longtitle ones.
            Of course, this did not change anything since it was just changing a variable name.)

            There is also a tree.php script that seems performing actions on the tree.
            Maybe it should be altered too.

            The night advised me to look closer at Bob’s solution : inverting the pagetitle and longtitle contents.
            I realized that this would not be bad in my case, escpecially considering my Wayfinder menus.
            So, I’ll stop here my core hacking tentatives.

            Regards.
              • 15001
              • 697 Posts
              I tried Bob’s solution : putting the main title in the "longtitle" field and the subtitle in "pagetitle".

              A new problem occured : for some pages, I do not want any subtitle; only a main title.
              So, the pagetitle field should remain empty.
              The problem is that a default "Page without title" text is automatically written in the pagetitle field when I let it empty and save the document. >:(
              Of course, this "Page without title" displays in my Wayfinder menus.

              What I’m planning is writting the same content in pagetitle and longtitle and display both titles only if there are different. Any better idea is also welcome.
                • 3749
                • 24,544 Posts
                I didn’t realize you needed pages with no subtitle.

                I think what I’d do is to put a descriptive page title on every document for viewing in the tree, then not use it in displaying the document (in fact, very few of us ever display the pagtitle on the screen). On the screen, I’d use some combination of longtitle, menutitle, description, alias or a custom Template Variable for the display.

                  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
                  • 15001
                  • 697 Posts
                  I plan to use a mini-snippet that will test if longtitle is empty or not.
                  I’ll always use a pagetitle. If the longtitle is not empty, I’ll use it as main title and pagetitle as subtitle.

                  @Bob: your solution is a good alternative. My snippet will avoid the need of an additional TV because since the client is probably not a CMS guru.
                  Cheers.