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

Call a .tpl on a subfolder

 
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 -> Smarty Development
View previous topic :: View next topic  
Author Message
gremio10
Smarty Rookie


Joined: 28 Jan 2011
Posts: 11

PostPosted: Thu Mar 31, 2011 3:41 am    Post subject: Call a .tpl on a subfolder Reply with quote

Hey guys, I have a problem, I create a folder inside of my templates called partner, and when I try to call on my PHP

Code:
$smarty->display( "partner/login.tpl" );


It return a error :

Code:
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'partner/login.tpl'' in C:\xampp\htdocs\coletivas\Smarty\libs\sysplugins\smarty_internal_template.php:163 Stack trace: #0 C:\xampp\htdocs\coletivas\Smarty\libs\sysplugins\smarty_internal_template.php(550): Smarty_Internal_Template->isExisting(true) #1 C:\xampp\htdocs\coletivas\Smarty\libs\Smarty.class.php(338): Smarty_Internal_Template->getRenderedTemplate() #2 C:\xampp\htdocs\coletivas\Smarty\libs\Smarty.class.php(382): Smarty->fetch('partner/login.t...', NULL, NULL, NULL, true) #3 C:\xampp\htdocs\coletivas\partner\login.php(13): Smarty->display('partner/login.t...') #4 {main} thrown in C:\xampp\htdocs\coletivas\Smarty\libs\sysplugins\smarty_internal_template.php on line 163


Thanks....
Back to top
View user's profile Send private message Send e-mail
jothirajan
Smarty Pro


Joined: 06 Feb 2009
Posts: 114
Location: India

PostPosted: Thu Mar 31, 2011 11:12 am    Post subject: Reply with quote

check whether you have set the smarty config file
Code:
 var $template_dir
Back to top
View user's profile Send private message Send e-mail
gremio10
Smarty Rookie


Joined: 28 Jan 2011
Posts: 11

PostPosted: Thu Mar 31, 2011 12:33 pm    Post subject: Reply with quote

it's "views" ... I thought that I could have more folders inside my template_dir...
Back to top
View user's profile Send private message Send e-mail
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Mar 31, 2011 3:36 pm    Post subject: Reply with quote

gremio10 wrote:
it's "views" ... I thought that I could have more folders inside my template_dir...


You can. Your display() call looks fine. You need to be sure your template_dir setting is correct. If it is "views" then you are relying on the php include_path to find it. Try setting template_dir to an absolute file system pathname. Also try $smarty->testInstall(); and see if that brings up any problems.

Another test, see if this spits out the template contents:

Code:
readfile($smarty->template_dir . '/partner/login.tpl');


If not, something isn't setup right, or the template file is missing/unreadable.
Back to top
View user's profile Send private message Visit poster's website
veesworld
Smarty n00b


Joined: 05 Apr 2011
Posts: 4

PostPosted: Tue Apr 05, 2011 4:38 pm    Post subject: Reply with quote

// absolute filepath (same thing)
$smarty->display('file:/usr/local/include/templates/header.tpl');
// windows absolute filepath (MUST use "file:" prefix)
$smarty->display('file:C:/www/pub/templates/header.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 -> Smarty Development 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