...

View Full Version : Help me on smarty setup error



kingot
01-24-2012, 01:33 PM
Hi ,
I am setting up a smarty template but it giving me an errors

Here is the error but mean while i have write the dir correct

Here is the error

( ! ) Warning: require(smarty_connect.php) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\index.php on line 3
Call Stack
# Time Memory Function Location
1 0.0025 364824 {main}( ) ..\index.php:0

( ! ) Fatal error: require() [function.require]: Failed opening required 'smarty_connect.php' (include_path='.;C:\php\pear') in C:\wamp\www\index.php on line 3
Call Stack
# Time Memory Function Location
1 0.0025 364824 {main}( )

And the pages are : index.php which is inside my main www dir


<?php
//starting index.php
require('smarty_connect.php');
$smarty= new smarty_connect.php;
$smarty->assign('name','Clement');
$smarty->display('index.tpl');
?>

And smarty_connect.php page which is outside the www root dir ..so i created a folder called smarty in disc c; and inside the smarty folder is where my demo, libs, template_c, cache folders are
here the code for smarty_connect.php


//smarting smarty connect

//first loading smarty libraries
require('smarty.class.php');
class smarty_connect extends smarty{

function smarty_connect(){
$smarty= new smarty;

$this->smarty();

$this->template_dir='C:\wamp\www\Smarty\templates';
$this->config_dir='C:\wamp\www\Smarty\config';
$this->compile_dir='C:\Smarty\templates_c';
$this->cache_dir='C:\Smarty\cache';


}
}

?>


And finally index.tpl page which is inside 'C:\Smarty\templates_c' means inside template_c
here is the code

<html>
<body>

Hello,{$name}
</body>
</html>


Please help,
Thanks

BluePanther
01-24-2012, 05:14 PM
Hi ,
I am setting up a smarty template but it giving me an errors

Here is the error but mean while i have write the dir correct

Here is the error

( ! ) Warning: require(smarty_connect.php) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\index.php on line 3
Call Stack
# Time Memory Function Location
1 0.0025 364824 {main}( ) ..\index.php:0

( ! ) Fatal error: require() [function.require]: Failed opening required 'smarty_connect.php' (include_path='.;C:\php\pear') in C:\wamp\www\index.php on line 3
Call Stack
# Time Memory Function Location
1 0.0025 364824 {main}( )

And the pages are : index.php which is inside my main www dir


<?php
//starting index.php
require('smarty_connect.php');
$smarty= new smarty_connect.php;
$smarty->assign('name','Clement');
$smarty->display('index.tpl');
?>

And smarty_connect.php page which is outside the www root dir ..so i created a folder called smarty in disc c; and inside the smarty folder is where my demo, libs, template_c, cache folders are
here the code for smarty_connect.php


//smarting smarty connect

//first loading smarty libraries
require('smarty.class.php');
class smarty_connect extends smarty{

function smarty_connect(){
$smarty= new smarty;

$this->smarty();

$this->template_dir='C:\wamp\www\Smarty\templates';
$this->config_dir='C:\wamp\www\Smarty\config';
$this->compile_dir='C:\Smarty\templates_c';
$this->cache_dir='C:\Smarty\cache';


}
}

?>


And finally index.tpl page which is inside 'C:\Smarty\templates_c' means inside template_c
here is the code

<html>
<body>

Hello,{$name}
</body>
</html>


Please help,
Thanks

The error message means it can't find the file in the path you've given. You've only given a filename, so it looks in the same directory as the executing script - in your case, index.php. It's not there, because it's above root dir. So, you need to either give it an absolute path
require('C:/path/to/smarty_connect.php'); or a relative path
require('../path/to/smarty_connect.php');

kingot
01-25-2012, 09:26 AM
Hi Sir,

Thanks very much for your support but unfortunatly, it still not working..!!
I''m trying many ways but still not getting it..!!
Now giving me this error

( ! ) Fatal error: Uncaught exception 'SmartyException' with message 'PHP5 requires you to call __construct() instead of Smarty()' in C:\Smarty\libs\sysplugins\smarty_internal_templatebase.php on line 803
( ! ) SmartyException: PHP5 requires you to call __construct() instead of Smarty() in C:\Smarty\libs\sysplugins\smarty_internal_templatebase.php on line 803

Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum