We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53452
    • 12 Posts
    I’m new to MODX, am not a web designer, and have very, very limited knowledge of html so please excuse any incorrect terminology. I need help/direction on how to add a button to a template variable and I’m having trouble understanding how to do it/where to do it. Using MODX Revolution 2.4.0-pl and can see the following listed under Plugins: CodeMirror, seoPRO, stercSEO, TinyMCE.

    The page that I need to add the button to is named Lawn Services and shows four TV areas on the page. This Lawn Services page is a child to the parent page named Services. The Services page also has four TV areas on the page and they each have a “Learn More” button that directs to a child page. (One of the Learn More buttons/TV areas on this page is for Lawn Services.) There are other child pages to Services page, that also contains the “Learn More” button and I thought I’d be able to copy code from either of these and paste/edit in the TV of the Lawn Services page. But the TVs are apparently different for parent and child pages and the child pages don’t have any code anywhere for the buttons like the parent TVs do. In case anyone needs it, here’s the basic structure.

    Services: This is a parent page and shows 4 TV sections. Each of the TVs contain coding for the buttons that show on the Services page.

    • Tree Services: Child to the Services page. There are 2 TV sections (Planting and Removal) that show on the Tree Services page -each with a button. When editing the page, there is no TV tab and no info. on the buttons. (Apparently, each of the TVs for this page reside within the respective pages below-which is where the buttons direct a visitor to).

    Planting -
    Removal -
    Planting and Removal are both child pages to the Tree Services page. When editing these pages, there is a TV tab, but no information on the button. Just the text that shows on the Tree Services page.


    • Lawn Services: Child to the Services page and has 4 TV sections. When editing this page, there is no TV tab and no info on the buttons.


    Landscaping -
    Mowing -
    Fertilization -
    Aeration -
    Each of these 4 pages are child pages to Lawn Services and are set up just like the Planting page and Removal page mentioned above.


    I need to add buttons to the TV sections on the Lawn Services page, just like they are on the Tree Services page. But since I can’t figure out where they are coming from on the Tree Services page, I can’t duplicate it on the Lawn Services page.

    I dug around a bit and found that there is a chunk called serviceTpl that has coding that references the “Learn More” button, but I don’t really understand chunks and how they work or what to do with it.

    Any direction or help that you can provide would be greatly appreciated to this newbie.

    This question has been answered by andytough. See the first response.

    • discuss.answer
      • 38783
      • 571 Posts
      It is a bit tricky trying to advise without being able to see some of the code that you refer to. A link to the site would be useful if you are happy to publish it here.

      Chunks are bits of static text which you can reuse across your site. https://docs.modx.com/revolution/2.x/making-sites-with-modx/structuring-your-site/chunks

      TVs can be made accessible to specific templates. So it is likely that pages with different TVs are using different templates.

      Could you post the contents of the serviceTpl chunk?

      It is likely that somewhere there is some code that performs a function that causes some information to be displayed and uses the chunk serviceTpl to define how it looks. This might be something like:

      [[!getResources? &parents=`5` &tpl=`serviceTpl`]]


      If you can find anything structured like that, which include the &tpl=`serviceTpl it would be useful to post that as well.

      You are using a version of MODX that has some serious security vulnerabilities. Ideally, if you can, you should upgrade it to the latest version. https://docs.modx.com/revolution/2.x/administering-your-site/upgrading-modx

      Before upgrading please make sure that you create a backup of you database and all the files. It would be sensible to upgrade all Extras first, then upgrade to version 2.5.0 and then to 2.5.7.

      Bob Ray has created a great extra that can make upgrading much easier https://bobsguides.com/upgrade-modx-package.html

        If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

        email: [email protected] | website: https://andytough.com