We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38547
    • 98 Posts
    I am sure this is something really basic but here goes.
    I an trying to find the best way to be able to update site content in places like the header/footer and maybe the sidebar, this is info which will be on on pages like address phone number etc.

    My thought is to do this with getpage or getresources by creating a new template and assigning some TV to it then create a new document which uses this new template and call it something like settings which would have some rich text TV fields to update the header or footer content and then in the getpage template just include the required TV.

    I just wondered it there was another way or this the best solution.

    Many thanks

    Ian
      • 22829 ☆ A M B ☆
      • 80 Posts
      There are multiple ways to do this.

      The way you describe, using TV's attached to a resource that will contain the site settings and then grabbing those TVs with getResources or getResourceField will work well, especially if you need to have that info editable as a part of a resource. This method can also work well when you have multiple areas on your site with different site info. I've used parent pages with special TV's to set all of the site info in the children this way (just use something like getResourceField with UltimateParent).

      You can also use chunks. And if you want to more easily change the information in the chunks, look into attaching property sets to the chunks. Chunks are probably more efficient as long as you don't need the info to be part of a resource.

      And there are even more ways, but I think the above are common.
        Time is what keeps everything from happening all at once.
        • 3749
        • 24,544 Posts
        +1 for what paulmerchant said.

        getResources and getPage can be very slow, especially so when they need to retrieve TVs.

        If you put the information in a chunk (or several chunks), it will already be formatted, is easily updated, and can be displayed anywhere with a chunk tag in the template:

        [[$ChunkName]]

          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
          • 38547
          • 98 Posts
          Quote from: BobRay at Aug 26, 2013, 05:49 PM
          +1 for what paulmerchant said.

          getResources and getPage can be very slow, especially so when they need to retrieve TVs.

          If you put the information in a chunk (or several chunks), it will already be formatted, is easily updated, and can be displayed anywhere with a chunk tag in the template:

          [[$ChunkName]]


          I can never remember whether chunks can be edited with rich text because I always write in HTML. If not, and you need the rich-text editing, the second choice would be a rich-text TV to hold the information and a simple TV tag in the template to display it:

          [[*TvName]]


          Your users could also edit the rich-text TVs in the front end with NewsPublisher if you'd prefer not to expose them to the Manager.

          Many thanks for the help, right now the info is held in chunks and I was looking for an easy way for someone to update these who does not understand html.
          In fact the
          [[*TvName]]
          looks like the perfect solution I will look into implementing that.

          Many thanks for the quick replies

          Regards

          Ian
            • 3749
            • 24,544 Posts
            Ian, actually I removed that part from the message once I realized that the TV would have to be edited separately for each page on the site.

            One option might be to create a dedicated (unpublished) Resource for each section, then use the getResourceField snippet (rather than a TV) to get the content field from the appropriate resource.
              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
              • 36996
              • 211 Posts
              You can also use ClientConfig for this - http://rtfm.modx.com/extras/revo/clientconfig