We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16858
    • 58 Posts
    I am using ModX 0.9.6

    I have a template variable that holds content for the right column of each page.

    I am passing the template variable to a snippet called RightColumnContent which then returns the content. I use a snippet because not all pages have a right column, and the snippet checks to see if the css page I am using (another template variable) has a right hand column, otherwise it ignores the right hand content.

    My problem is this: when I include two snippets within a template variable, and send that content to my right hand snippet for displaying, only the second snippet is parsed. The first one is not. An example of my right hand content is:

    [[Title? &style=`1` &color=`tan` &text=`In Theaters` &holiday=`1`]] 
    [[NewsParserX? &url=`http://movies.go.com/xml/rss/intheaters.xml` &image=`true` &descr=`true`]]


    When this is displayed, the result is:

    [[Title
    ... NewsParser data appears as it should ...
    `]]

    Both snippets used above work, as individually on other pages there are no errors.

    Any insight before I pull out ALL my hair would be greatly appreciated!
      • 33372
      • 1,611 Posts
      That’s an odd problem, possibly related to the order of parsing nested snippets/chunks/TVs/etc. I’ve never had that happen before, however, so I can’t say why you might be seeing it. A quick fix that might make it work (without explaining why it’s happening) might be to call one of your snippets uncached ("[!...!]").
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn't very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
        • 16858
        • 58 Posts
        Gave that a shot but didn’t work.

        Thought I would provide all related code in case someone has an idea ...

        Here is the snippet call within the master template for the right column:

        [[RightColumnContent? &css=`[*CSS*]` &content=`[*Right Column Content*]`]]


        Here is the RightColumnContent snippet:

        <?php
        /**
         * @name RightColumnContent
         * @version 1.0
         * 
         * Description:
         * Returns fully built content for the right column
         *
         * Changelog:
         * 2007-07-04 - Initial Release
         *
         * Parameters:
         * &css = CSS template used for formatting to determine which content to include
         * &content = User content provided through the right column content template variable
         */
        
         $_output = '';
        
         if ($css == 'css120.css') {
             $_output .= '<div id="right_column_content">' . $content . '</div>';
         }
         elseif ($css == 'css160.css') {
             $_output .= '<div id="right_column_content">' . $content . '</div>';
         }
         elseif ($css == 'css.css') {
             $_output .= '<div id="right_column_content">' . $content . '</div>';
         }
         elseif ($css == 'css250.css') {
             $_output .= '<div id="right_column_content">' . $content . '</div>';
         }
         elseif ($css == 'css300.css') {
             $_output .= '<div id="right_column_content">' . $content . '</div>';
         }
         else {
             $_output = '';
         }
        
         return $_output;
        ?>
          • 33372
          • 1,611 Posts
          Seems like something is breaking up your backtick quotes (maybe it has to do with the TV values that are being inserted?). As far as I can tell, you have a snippet that accepts TV’s as values and then sometimes outputs other snippets as content. So that would be three passes through the parser, which seems kind of excessive to me (since you could just use an @EVAL for the TV output and be done in one pass).
            "Things are not what they appear to be; nor are they otherwise." - Buddha

            "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

            Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
            • 16858
            • 58 Posts
            Not sure how to use @EVAL ... can you provide an example?
              • 33372
              • 1,611 Posts
              Check out these links:
              http://www.modxcms.com/eval-binding.html
              http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks

              Also: Depending upon what version of MODx you’re using, there was a bug (I think only in 0.9.5) that made it necessary to put all of your @EVAL code on one line (or it wasn’t executed). You could always put your code in a snippet (like you do now) and run that as the output of the TV (see the second link above for an example), so then your code will only be that one line anyway. That’s what I often do, and i find it simple and functional.

              You could also use PHx to add logic to TVs, but keep in mind that it will no longer work in 0.9.7.
                "Things are not what they appear to be; nor are they otherwise." - Buddha

                "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                • 22770
                • 285 Posts
                Quote from: ZAP at Jul 04, 2007, 10:52 PM


                You could also use PHx to add logic to TVs, but keep in mind that it will no longer work in 0.9.7.


                Is that ’PHx won’t work in 0.9.7’ or ’PHx to add logic only to TVs won’t work in 0.9.7’? Just wondering as I’m using PHx for both in various places.
                  • 33372
                  • 1,611 Posts
                  As I understand it, PHx won’t work at all in 0.9.7. Instead there will be a different built-in method for achieving the same results. So when 0.9.7 is released PHx-users can either convert their code to the new system or stay with 0.9.6.
                    "Things are not what they appear to be; nor are they otherwise." - Buddha

                    "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                    Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: ZAP at Jul 05, 2007, 10:10 AM

                    As I understand it, PHx won’t work at all in 0.9.7. Instead there will be a different built-in method for achieving the same results. So when 0.9.7 is released PHx-users can either convert their code to the new system or stay with 0.9.6.
                    This is not an accurate statement.

                    PHx will be an optional "core extension" to the MODx parser that will "extend" two base classes, modInputFilter and modOutputFilter. These base classes provide hooks into the modElement/modTag classes that represent specific template tags, allowing these to work in a similar way to PHx; modifiers can be applied to the tag before processing (input) as well as after processing (output). Bottom line: PHx functionality should still be available once 0.9.7+ is released, though there may have to be some specific minor adjustments for it to work with the new tag formats.
                      • 33372
                      • 1,611 Posts
                      Well, technically it’s accurate because I started it with "As I understand it..." wink

                      Which should be a red flag to anyone familiar with my posts...

                      Thanks for the clarification.
                        "Things are not what they appear to be; nor are they otherwise." - Buddha

                        "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options