We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24665
    • 14 Posts
    I’ve just updated from 2.0.8 to 2.1.3. The homepage still works the same, but all my content pages now give the following error:

    Fatal error: Call to undefined method modX::getTemplateVarOutput() in /home/blablabla/domains/website.net/public_html/core/cache/includes/elements/modsnippet/10.include.cache.php on line 7


    I’ve seen another topic covering this, but somehow I can’t seem to get it working again. huh Can someome please help?

    -edit-

    I’ve figured out that a .js file is different from my original test install (thats works correctly) and the live install. What changed in 2.1.3 that causes Modx to flip out over a .js file? smiley
      • 28215
      • 4,149 Posts
      Disable whatever snippet is ID 10, and make sure you’ve upgraded all your Extras you downloaded through Package Management. $modx-> getTemplateVarOutput is a deprecated method that was removed in 2.1:

      http://rtfm.modx.com/display/revolution20/Upgrading+from+2.0.x+to+2.1.x
      http://rtfm.modx.com/display/revolution20/Summary+of+Legacy+Code+Removed+in+2.1
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 24665
        • 14 Posts
        Great, that fixes the error, but also doesnt show a page anymore. I get the basic template now, but not the content... huh
          • 3749
          • 24,544 Posts
          Quote from: reb87 at Aug 13, 2011, 03:31 PM

          Great, that fixes the error, but also doesnt show a page anymore. I get the basic template now, but not the content... huh
          what was the snippet?
            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
            • 24665
            • 14 Posts
            snippet with id10 was wrapcontent
              • 3749
              • 24,544 Posts
              I don’t see it in the repository. I’m guessing that in your template, where the [[*content]] tag would go, is a tag for that snippet (with the content tag as a property). It’s disabled, so your content is missing.

              You can replace the snippet tag with a [[*content]] tag, or rewrite the snippet to get rid of the deprecated function(s).

              Feel free to post the snippet code here.
                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
                • 24665
                • 14 Posts
                The wrapcontent snippet contains the following code:

                <?php
                if ( $TVarray = $modx->getTemplateVarOutput(array('LeaveContentUnwrapped')) )
                {
                    $tvOutput = $TVarray['LeaveContentUnwrapped'];
                    if(empty($tvOutput))
                        return $prefix.$content.$suffix;
                    else
                        return $content;
                }


                If I delete this snippet, it doesnt affect the site in any other way than that it removes the error from the startpost, and doesnt display my content in one page (with a template that uses a .js file)
                  • 3749
                  • 24,544 Posts
                  What does the [[wrapcontent . . .]] tag in your template(s) look like.
                    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
                    • 32316
                    • 387 Posts
                    Ummmmm

                    Why not just rewrite the wrapcontent snippet without using modX->getTemplateVarOutput() (follow the 2nd link from the second post - and then on to the rest of the docs)

                    the 2nd link suggests: use modTemplateVar->renderOutput() on a collection of modTemplateVar objects
                      • 24665
                      • 14 Posts
                      Thanks for the help guys. But when I change it, I get the same error.

                      <?php
                      if ( $TVarray = $modx->renderOutput(array('LeaveContentUnwrapped')) )
                      {
                          $tvOutput = $TVarray['LeaveContentUnwrapped'];
                          if(empty($tvOutput))
                              return $prefix.$content.$suffix;
                          else
                              return $content;
                      }