We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30088
    • 47 Posts
    I’m not sure what this is called or how to make a search for this kind of function in the forums. Any help is much appreciated!

    I have a site where there is a side bar - not the typical navigation sidebar though. It just contains information which changes depending on which page the person is on.

    Ie: The home page:
    Has the content in the main content area. On the sidebar is the address and business hours for the business.

    An inside page:
    Has the content in the main content area, but now there’s photos in the sidebar instead of the address information.

    etc.

    What do I use for that? Snippets? Chunks? I’m confused... thanks!
      • 6726
      • 7,075 Posts
      Pretty easy with MODx : that’s what template variables are for smiley

      1. Create a template variable : Resources > Manage Resources > Template Variables, click "New Template Variable". Set the various fields and don’t forget to assign your variable the templates you want to use it with.

      2. Add the template variable where you want it displayed in your templates : easy, just add [*my_template_variable*] in your template code.

      3. Edit any document which has the TV assigned : you’ll have a field for it. Fill it with whatever content you need to

      You’re set !

      More details here : http://modxcms.com/template-variables.html


        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 30088
        • 47 Posts
        Great - thanks for the tip! I’ve set up a template variable and assigned it to my template. I then created a page that uses that template, and it shows up fine. However, I have tried multiple times to enter the Template Variable for that page with that template, and it disappears as soon as I save it. I paste in the content, click Save on the page, and then I go to Edit the same page and the content is all gone, as if I hadn’t changed anything. Also, nothing loads on the published page in the area where I’ve put the template variable. I’m not sure what’s going wrong - I’ve referenced the TV in my template with the correct name and in the right location, and I’m clicking save after entering the information. Has anyone else had trouble like this?
          • 6726
          • 7,075 Posts
          You shouldn’t experiment any problem of this kind.

          Let’s do some troubleshooting : How do you proceed to "enter the template variable for that template" ? If you’re creating a document, selecting the template for that document, click OK, see the TV field appear when editing the document and save, you have done the right thing. If not, try this one.

          It you have the right method, then we’ll need to have your phpinfo() handy (go to the manager and click Reports > System Info > phpinfo() : view)



            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id
            • 30088
            • 47 Posts
            Hmm. It simply appears as though the paste function in MODx is finnickety. Basically, if I copy and paste my HTML code that I have prepared directly into the HTML box of the WYSIWYG editor I have loaded for this particular TV, it doesn’t save it. If I type directly into the WYSIWYG editor, it saves. If I paste the code using the "Paste as Plain Text" button in the editor, and then edit the HTML to remove the extra tags it inserts, it saves as well. So that is how I am working around this. I’m not sure if it’s a PHP problem, or if it’s just that the WYSIWYG editor for TVs is perhaps a bit buggy?
              • 6726
              • 7,075 Posts
              Ok that explains it... I’d lean toward a javascript security setting from your browser or antivirus software...
                .: COO - Commerce Guys - Community Driven Innovation :.


                MODx est l'outil id