wysn Smarty n00b
Joined: 14 Aug 2011 Posts: 1
|
Posted: Sun Aug 14, 2011 5:47 am Post subject: smarty3.0.8 installation problem |
|
|
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! |
|