We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37126
    • 37 Posts
    Can anyone tell me why the following maybe failing now where previously it worked?

    global $modx;
    require_once '/home/public_html/config.core.php';
    require_once MODX_CORE_PATH.'model/modx/modx.class.php';
    $modx = new modX();
    
    $modx->initialize('web');
    $modx->getService('error','error.modError');
    
    $siteStartId = $modx->getOption('site_start');
    
    $modx->resource = $modx->getObject('modResource',$modx->getOption('site_start'));
    $modx->user = $modx->getObject('modUser',1);
    


    I have a site which uses lime survey and have integrated Wayfinder calls into the header and footer of the template. The header still works but the page gets stuck afterwards with the following error message:

    Fatal error: Cannot redeclare class modTemplateVarOutputRenderDefault in /home/public_html/core/model/modx/processors/element/tv/renders/web/output/default.class.php on line 16

    So I guess the class has already been declared somewhere else. Should I be calling Modx differently or should I be looking in my setup elsewhere?

    Thanks in advance for any help with this.
      • 3749
      • 24,544 Posts
      Try adding this at line 8:

      $modx->getRequest();


      and changing line 11 to:

      $modx->resource = $modx->getObject('modResource', $siteStartId);


      More info here: http://bobsguides.com/blog.html/2013/07/13/using-modx-outside-of-modx/

      If that doesn't work, there may be something odd about one of the TVs used on the home page.
        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
        • 37126
        • 37 Posts
        Thanks Bob,
        Turned out to be a TV for a banner using getChunk.

        Changing

        $html .= $modx->getChunk("bannerAds"); 


        to

        $html .= $modx->getChunk($bannerAds); 


        Fixed it [ed. note: cprookie last edited this post 12 years, 10 months ago.]
          • 3749
          • 24,544 Posts
          Weird. Glad you got it sorted.
            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