Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Fatal Error: Unable to load Template File 'browse.tpl'

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
desi4eva
Smarty n00b


Joined: 24 Jun 2013
Posts: 1

PostPosted: Mon Jun 24, 2013 1:42 pm    Post subject: Fatal Error: Unable to load Template File 'browse.tpl' Reply with quote

Hi,

Hopefully someone can help me with this issue.

It works when in the /www/html/ folder if the index.html is placed there but doesn't work when the same file is placed in a subdirectory.

The template folder is in the default location i.e. var/www/html/templates

The html file: /var/www/html/browse/index.html

The code within the index.html is:

Code:
 <?php
    ini_set('display_errors', 0);
    error_reporting(E_ALL);
   
    require(dirname(__FILE__) . '../includes_browse.php');
   
    $old_error_handler = set_error_handler(array('Controller', 'handleError'), E_ALL);
   
    $controller = new Controller();
    $controller->processRequest();
    $controller->displayOutput();
?>


And the error i get is:

Code:
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'browse.tpl'' in /var/www/html/lib/Smarty/libs/sysplugins/smarty_internal_templatebase.php:127 Stack trace: #0 /var/www/html/lib/Smarty/libs/sysplugins/smarty_internal_templatebase.php(374): Smarty_Internal_TemplateBase->fetch('browse.tpl', NULL, NULL, NULL, true) #1 /var/www/html/classes/Controller_browse.php(336): Smarty_Internal_TemplateBase->display('browse.tpl') #2 /var/www/html/browse/index.php(14): Controller->displayOutput() #3 {main} thrown in /var/www/html/lib/Smarty/libs/sysplugins/smarty_internal_templatebase.php on line 127



Thanks in advance.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Mon Jun 24, 2013 7:20 pm    Post subject: Reply with quote

The default definition of the templates folder is ./templates which is relative to your calling script (in your case index.html).
If you move your script into a subfolder you should redefine the Smarty folders template_dir, compile_dir, cache_dir and plugins_dir with an absolute fileplath.

See for example http://www.smarty.net/docs/en/variable.template.dir.tpl
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP