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

smarty3.0.8 installation problem

 
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
wysn
Smarty n00b


Joined: 14 Aug 2011
Posts: 1

PostPosted: Sun Aug 14, 2011 5:47 am    Post subject: smarty3.0.8 installation problem Reply with quote

hi,
i am new to smarty3.0.8.
"demo_root.php"--I am getting below error while installing Smarty.

Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'index.tpl'' in F:\xampp\htdocs\Smarty\libs\sysplugins\smarty_internal_template.php:163 Stack trace: #0 F:\xampp\htdocs\Smarty\libs\sysplugins\smarty_internal_template.php(552): Smarty_Internal_Template->isExisting(true) #1 F:\xampp\htdocs\Smarty\libs\Smarty.class.php(338): Smarty_Internal_Template->getRenderedTemplate() #2 F:\xampp\htdocs\Smarty\libs\Smarty.class.php(382): Smarty->fetch('index.tpl', NULL, NULL, NULL, true) #3 F:\xampp\htdocs\demo_root.php(27): Smarty->display('index.tpl') #4 {main} thrown in F:\xampp\htdocs\Smarty\libs\sysplugins\smarty_internal_template.php on line 163

"demo.php" is ok.

root:F:\xampp\htdocs\
F:\xampp\htdocs
.....| demo_root.php
.....| smarty-config.php
.....| wenjian.txt
.....|
.....\--Smarty
........... +-------demo
........... |........... | demo.php
........... |........... | index_php_template.php
........... |........... |
........... |........... +--cache
........... |........... |
........... |........... +--configs
........... |........... |
........... |........... |
........... |........... +--templates
........... |........... |......... footer.tpl
........... |........... |......... header.tpl
........... |........... |......... index.tpl
........... |........... |......... index_view.php
........... |........... |
........... |........... \---templates_c
........... |
........... |
........... \--------- libs
........................... | debug.tpl
........................... | Smarty.class.php
........................... |
........................... +--plugins
........................... |
........................... \---sysplugins

demo_root.php
<?php

require('smarty-config.php');
$smarty = new Smarty;
//$smarty->force_compile = true;
$smarty->debugging = true;
$smarty->caching = true;
$smarty->cache_lifetime = 120;
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill",true);
$smarty->assign("FirstName",array("John","Mary","James","Henry"));
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
array("I", "J", "K", "L"), array("M", "N", "O", "P")));
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));

$smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX"));
$smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas"));
$smarty->assign("option_selected", "NE");

$smarty->display('index.tpl');
?>

smarty-config.php
<?php
if ( !defined('SMARTY_PATH') )
define('SMARTY_PATH',str_replace('\\','/',dirname(__FILE__)) . '/');

if ( !defined('TEMPLATES_PATH') )
define('TEMPLATES_PATH',SMARTY_PATH . 'Smarty/demo' . '/');

require SMARTY_PATH. 'Smarty/libs' . '/' . 'Smarty.class.php';

$smarty = new Smarty;

$smarty->template_dir = TEMPLATES_PATH . 'templates' . '/';
$smarty->complile_dir = TEMPLATES_PATH . 'templates_c' . '/';
$smarty->config_dir = TEMPLATES_PATH . 'configs' . '/';
$smarty->cache_dir = TEMPLATES_PATH . 'cache' . '/';

?>

Please help me,thanks!
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Sun Aug 14, 2011 4:44 pm    Post subject: Reply with quote

In smarty-config.php you create the $smarty object.
But after require smarty-config.phpo you are overwriting this with anoter
$smarty = new Samrty;
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