|
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 |
wantho Smarty Rookie
Joined: 21 Sep 2011 Posts: 8
|
Posted: Wed Sep 28, 2011 10:01 am Post subject: Stuck at the first hurdle. |
|
|
I have downloaded 'Smarty 3.1' and unzipped the libs file to the 'Wamp' document root c:/wamp/www/ and placed it into dir/folder 'Smarty'.
In the document root I have also created another dir/folder named 'myapp'.
'Smarty/' holds the unzipped 'Libs' file contents and 'myapp/' has 4 empty dir/folders in it plus 2 .php files:
The folders are: templates/, templates_c/, cache/ and config/,
the 2 .php files are myapp/smarty.php and myapp/index.php.
myapp/smarty.php:
<?php
//Use the absolute path for Smarty.class.php
$base_path = (dirname(__FILE__));
require ($base_path.'/Smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = $base_path.'/myapp/smarty/templates';
$smarty->compile_dir = $base_path.'/myapp/smarty/templates_c';
$smarty->cache_dir = $base_path.'/myapp/smarty/cache';
$smarty->config_dir = $base_path.'/myapp/smarty/config';
?>
myapp/index.php:
<?php
require_once('smarty.php');
$smarty->assign('test, 123');
$smarty->display('index.tpl');
?>
There is also a .tpl in the myapp/smarty/templates folder:
on opening myapp via wampserver localhost the returning error is:
Warning: require(C:\wamp\www\myapp/Smarty/Smarty.class.php) [function.require]: failed to open stream:
No such file or directory in C:\wamp\www\myapp\smarty.php on line 4
Line 4 is:
require ($base_path.'/Smarty/Smarty.class.php');
The 'Smarty' version used with the book was pre 3.1 which would mean a slightly different file structure. |
|
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
|