|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
gremio10 Smarty Rookie
Joined: 28 Jan 2011 Posts: 11
|
Posted: Thu Mar 31, 2011 3:41 am Post subject: Call a .tpl on a subfolder |
|
|
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 |
|
jothirajan Smarty Pro
Joined: 06 Feb 2009 Posts: 114 Location: India
|
Posted: Thu Mar 31, 2011 11:12 am Post subject: |
|
|
check whether you have set the smarty config file
|
|
Back to top |
|
gremio10 Smarty Rookie
Joined: 28 Jan 2011 Posts: 11
|
Posted: Thu Mar 31, 2011 12:33 pm Post subject: |
|
|
it's "views" ... I thought that I could have more folders inside my template_dir... |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Mar 31, 2011 3:36 pm Post subject: |
|
|
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 |
|
veesworld Smarty n00b
Joined: 05 Apr 2011 Posts: 4
|
Posted: Tue Apr 05, 2011 4:38 pm Post subject: |
|
|
// 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 |
|
|
|
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
|