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

    Let me start off by saying I’m really loving working with MODx so far. It’s such a great application. I have a pretty straightforward question regarding template variables. I have a two-column template I’m using for several pages. I would like to be able to assign a different variable in the sidebar for each page, but the way I’m understanding this so far is I put the TV name [*variable_name*] in the sidebar of the template and then assign in to a template to be passed through. Hence I need to re-use (and re-create) the same two-column template for each TV I would like to use. Is there a way to just use one two-column template and choose a TV to use with that particular page? Logically there must be, so I think I’m not fully understanding how to use TV’s.

    Thank in advance for any help/suggestions. wink

    msflux.
      • 7231
      • 4,205 Posts
      You can use a TV to display a chunk with the appropriate sidebar. Basically you could list the available chunks and select the one you want (either checkbox, pull down or simply a text box). And in the template you put the call for the TV which will be filled with the correct chunk call.

      There is a tutorial in the wiki on this subject (TV based chunks) with some good tips for doing this.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 20508
        • 157 Posts
        Nice, thanks - I’ll check that out. Sounds perfect!

        Cheers,
        msflux.
          • 20508
          • 157 Posts
          I’m almost successful in implement dynamic chunks using template variables, (with this great tutorial: http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks#Create_Some_Chunks).

          However, I’m getting a parse error listed below. My document validates, so I don’t think the extra "<" is coming from my code. I think it’s being caused when this line of code (in my template) is used to call in the information (include): [!chunkListParser?chunks=`[*leftChunks*]` &wrapperdiv=`left`!]

          Parse error: syntax error, unexpected ’<’ in /usr/home/xxx/public_html/mywebsite.com/manager/includes/document.parser.class.inc.php(766) : eval()’d code on line 2

          Any suggestions?

          Thanks!
          msflux.
            • 20508
            • 157 Posts
            I found this little tidbit of information regarding the Parse Error that I’m having. I’m using version 0.9.6 of MODx. I tried removing the "<?php" in the first line of code and the "<?" in the last line in the PHP document "document.parser.class.inc.php" but that did not work - made the page go away completely. However I still think the issue is coming from this document.

            Documentation:

            "Parse error, unexpected ’<’ in /manager/includes/document.parser.class.inc.php(705) : eval()’d code on line 1"

            "This is one of the most common parse errors in pre 0.9.5 releases. There is a <? or <?php in the first line of the snippet code which must be removed. Also, look at the end of the snippet code and ensure it does not contain ?>. In 0.9.5+ <?php tag is detected in the snippet code and dealt with. Developers often put <?php to the start of the snippet code to get syntax coloring working in their text editors and that’s the most common reason why you may see some snippets having them."

            Source: http://wiki.modxcms.com/index.php/Common_snippet_error_messages_and_their_meaning


            Anyone run into this issue or have any thoughts on how to resolve it?

            Thanks!
            msflux.
              • 22303 MODX Staff
              • 10,725 Posts
              Please do not double-post the same issue under separate topics.

              Cheers!
                • 20508
                • 157 Posts
                Apologies. undecided

                Thank you muchly.