Help needed in smarty error

Coding Critique is the place to post source code for peer review by other members of DevNetwork. Any kind of code can be posted. Code posted does not have to be limited to PHP. All members are invited to contribute constructive criticism with the goal of improving the code. Posted code should include some background information about it and what areas you specifically would like help with.

Popular code excerpts may be moved to "Code Snippets" by the moderators.

Moderator: General Moderators

Post Reply
waseem83
Forum Commoner
Posts: 54
Joined: Tue Jun 23, 2009 3:51 am
Contact:

Help needed in smarty error

Post by waseem83 »

Fatal error: Smarty error: the $compile_dir '/templates_c' does not exist, or is not a directory. in C:\xampp\htdocs\NS\smarty\libs\Smarty.class.php on line 1088.

Can any body resolve my this error ?
User avatar
tr0gd0rr
Forum Contributor
Posts: 305
Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA

Re: Help needed in smarty error

Post by tr0gd0rr »

Example 2-9 on http://www.smarty.net/manual/en/install ... .basic.php

You need to give smarty a directory where it will cache it's compiled templates.

Code: Select all

<?php
 
require_once(SMARTY_DIR . 'Smarty.class.php');
 
$smarty = new Smarty();
 
$smarty->template_dir = '/web/www.example.com/guestbook/templates/';
$smarty->compile_dir  = '/web/www.example.com/guestbook/templates_c/';
$smarty->config_dir   = '/web/www.example.com/guestbook/configs/';
$smarty->cache_dir    = '/web/www.example.com/guestbook/cache/';
 
$smarty->assign('name','Ned');
 
//** un-comment the following line to show the debug console
//$smarty->debugging = true;
 
$smarty->display('index.tpl');
 
?>
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: Help needed in smarty error

Post by cpetercarter »

Remember too that the 'templates_c' directory must be writeable.
Post Reply