We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49324
    • 14 Posts
    Hello, i'm getting started on MODX Revo and had a (hopefully) basic question:
    I have to create a page with some "static" elements, these elements will have to be shared between different pages and should be easily editable by a user with no coding knowledge.

    So supposing i have a template that is the base for all the pages i create, how should i create these elements?

    1. Creating a chunk could be fine, but then it would be impossible to edit it's content by a user with no coding knowledge. In fact the chunk will have at least HTML tags for the styles of the contained text.
    2. Using a Template Variable seems not doable since that would mean to change its content for each page i create based on that single Template.

    A real life example for the above could be a set of web pages where i want to insert the description of the company, this latter should be easily editable by the company. By updating a single element, the company description should be updated on all the pages in the website.

    What would be the best solution?
    Thank you very much
      • 3749
      • 24,544 Posts
      Chunks are the standard place for such content, but if the users can't handle editing the chunks, you could let them edit a resource (in the front end with NewsPublisher if you like, where they'd only see the content field in a richtext editor), then a plugin attached to OnDocFormSave could write that content to the chunk, or you could just leave it in the resource and use something like FastField in your template to get the content field.

      BTW, I've had surprisingly good luck telling users that they should learn HTML. YMMV wink
        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
        • 4172
        • 5,888 Posts
        you could create a Manager-Page, where they can edit only that chunks, with a richtext-editor, if you prefer.

        The manager-page could be created with MIGXdb.

        clientConfig might me another option.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 49324
          • 14 Posts
          Hey thanks for the quick and detailed answers!
          Could i call a snippet from a chunk and that snippet will output the content of a resource with FastField? This way, as Bob said, the client could manage the content with a rich text editor.

          I will give MIGXdb a try too, but considering my actual knowledge i find the other solution easier to implement.
          Thanks again for the help, i really appreciate it.
            • 36926
            • 701 Posts
            Depending exactly what the content is I reckon clientConfig will work. I use it on most site now.

            Before clientConfig I use to either setup a resource called global variables or add a category to the home page called that, then assign TVs for all the editable regions I wanted to use across the site. Then I'd use getResourceField extra to reference them.

            EDIT:
            Link to clientConfig docs
            https://www.modmore.com/extras/clientconfig/documentation/

            [ed. note: bennyb last edited this post 11 years, 11 months ago.]
              • 36926
              • 701 Posts
              It's defo worth spending some time learning bruno's MIGXdb, super powerful.

              @bob Don't you find once they know html they ending up adding in all sorts of rubbish to the code. I've had some interesting choices of background colours applied before. I've ended up in the past using plugins to strip out some of the stuff they add.

                • 49324
                • 14 Posts
                ok, with both clientConfig and MIGXdb i can also set rich text fields (or text fields + tinyMCE)?
                This is what i'd need for now...some styled text inside some divs/elements that are styled with css etc...
                  • 25803 ☆ A M B ☆
                  • 721 Posts
                  We create an admin document and assemble a bunch of relevant template variables for it, categorized of course and then use FastField to retrieve them.

                  For example:
                  [[#[[++admin_doc_id]].tv.companyname]]

                  Where [[++admin_doc_id]] is a context setting that has the value of the Resource that is the admin document.

                  There is a richtext type of Template Variable you can use for rich text. We do it all the time, for example:

                  [[#[[++admin_doc_id]].tv.aboutsummary]]

                  aboutsummary is a richtext TV that the user can input their about us summary that may appear in the footer of every document.

                  We don't bother with clientconfig because it's not context sensitive or aware.

                  Of course, the migxdb method may be better and a method whereby you can do a custom manager page that is not a resource but for regular non programmer folk, this method works well.
                    • 3749
                    • 24,544 Posts
                    Just a note, the NewsPublisher tag would look like this:

                    [[!NewsPublisher? &show=`content` initrte=`1` rtcontent=`1`]]

                    The user would see only the content field and would be editing it with TinyMCE.

                    You'd have a resource (unpublished and/or hidden from menus) for each piece of static content. You could pull the content field from that resource directly with a very simple snippet or with FastField.

                    @bennyb: I give them a list of HTML tags they're allowed to use -- no inline CSS allowed.

                      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
                      • 4172
                      • 5,888 Posts
                      with MIGXdb you would need this steps to create your CMP (Out of my head):

                      put all your customer-chunks into one category

                      Go to the MIGX-CMP to the tab 'MIGX'
                      create a new MIGX-config with name and a unique MIGX ID of 'customerchunks'

                      at the tab 'MIGXdb-Settings' put:
                      classname: modChunk
                      where: {"category":"put_here_the_id_of_your_category"}

                      at the tab 'CMP-Setting' put:
                      Main Caption: Customers Chunk Manager
                      Tab Caption: Customer Chunks
                      Tab Description: Manage your customer chunks here

                      at the tab 'Contextmenues' select 'update'

                      at the tab 'Columns' create three columns:
                      Header: ID
                      field: id

                      Header: Name
                      field: name

                      Header: Description
                      field: description

                      at the tab 'Formtabs':
                      Add a new Formtab
                      Caption: Chunk Content
                      Add a field to that Formtab
                      Fieldname: snippet
                      Caption: Chunk Content
                      input TV type: richtext

                      close all three open windows with 'Done'!

                      Create a new MODX Manager Menu-Item
                      Lexicon-Key: Customer Chunk Manager
                      action: index
                      parameters: &configs=customerchunks
                      namespace: migx

                      Done.

                      btw:
                      You could also teach them textile-markup and use the textile-output-filter for your chunks
                      Then is no richtext-editor needed.


                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!