We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37167
    • 3 Posts
    Following the tutorial here: http://rtfm.modx.com/display/revolution20/Custom+Manager+Pages

    I try to use a smarty template that I save at /manager/assets/templates/games.tpl.

    That file contains just this: "<strong>games here</strong>".

    When I hit the components dropdown menu and select my "games" workspace I get the error below.

    If /core/components/games/indexp.php contains "return $modx->smarty->fetch( '/manager/assets/templates/games.tpl' );" I get the error below.

    If /core/components/games/indexp.php contains "return '<h2 class="modx-page-header">Games</h2>';" it works just fine.

    Is something not setup correctly? Thank you in advance for any responses.

    Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file '/manager/assets/templates/games.tpl'' in E:\Shared\web\pcgamescout\core\model\smarty\sysplugins\smarty_internal_template.php:162 Stack trace: #0 E:\Shared\web\pcgamescout\core\model\smarty\sysplugins\smarty_internal_template.php(537): Smarty_Internal_Template->isExisting(true) #1 E:\Shared\web\pcgamescout\core\model\smarty\Smarty.class.php(335): Smarty_Internal_Template->getRenderedTemplate() #2 E:\Shared\web\pcgamescout\core\model\modx\smarty\modsmarty.class.php(143): Smarty->fetch('/manager/assets...') #3 E:\Shared\web\pcgamescout\core\components\games\index.php(6): modSmarty->fetch('/manager/assets...') #4 E:\Shared\web\pcgamescout\core\model\modx\modmanagerresponse.class.php(83): include('E:\Shared\web\p...') #5 E:\Shared\web\pcgamescout\core\model\modx\modmanagerrequest.class.php(182): modManagerResponse->outputContent(Array) #6 E:\Shared\web\pcgamescout\core\model\modx\modmanagerrequest.class.php(133): modManagerRequest->pr in E:\Shared\web\pcgamescout\core\model\smarty\sysplugins\smarty_internal_template.php on line 162
      • 3749
      • 24,544 Posts
      I'm not a Smarty expert, but I think the Smarty template path is manager/templates/ or manager/templates/default/.

      Try putting your file there and using just the filename in the fetch().
        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
        • 37167
        • 3 Posts
        I've tried both of those locations and used just the filename as you suggested, but still no go. I get the same error message.

        I even tried copying this line: "return $modx->smarty->fetch('resource/staticresource/update.tpl');" right out of \core\model\modx\modmanagerrequest.class.php and I still get the same error.
          • 37167
          • 3 Posts
          Okay, thanks to this forum topic on smarty.net I was able to get it to work.

          http://www.smarty.net/forums/viewtopic.php?p=69683

          "The relative dir will be relative to the executing script, so looking at your directory structure, the template_dir setting may need to be ../smarty/demo/templates or just use the absolute system filepath to be sure."

          Here's what worked for me:

          return $modx->smarty->fetch('templates/games.tpl');


            • 3749
            • 24,544 Posts
            I'm glad you got it working. Thanks for reporting back -- I'm sure that information will help other users down the road. smiley
              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
              • 41600
              • 3 Posts
              rosejianBanned Reply #6, 14 years ago
              <spam> [ed. note: markh last edited this post 14 years ago.]