roscoeh23
asked on
problem with smarty
Warning: Smarty error: unable to read resource: "../smarty/index.tpl" in c:\Inetpub\wwwroot\nhs\sma rty\Smarty .class.php on line 1095
This is the error get when I try to use smart on a tpl file I have created. Both the index.tpl and the smarty class are in the same folder(../smarty/). I am running it locally but want to simulate how it will work when I upload it to my webserver so have not changed the php.ini or anything.
This is the file...
<?
include('../smarty/Smarty. class.php' );
// create object
$smarty = new Smarty;
// assign some content. This would typically come from
// a database or other source, but we'll use static
// values for the purpose of this example.
$smarty->assign('name', 'george smith');
$smarty->assign('address', '45th & Harris');
// display it
$smarty->display('../smart y/index.tp l');
?>
This is the error get when I try to use smart on a tpl file I have created. Both the index.tpl and the smarty class are in the same folder(../smarty/). I am running it locally but want to simulate how it will work when I upload it to my webserver so have not changed the php.ini or anything.
This is the file...
<?
include('../smarty/Smarty.
// create object
$smarty = new Smarty;
// assign some content. This would typically come from
// a database or other source, but we'll use static
// values for the purpose of this example.
$smarty->assign('name', 'george smith');
$smarty->assign('address',
// display it
$smarty->display('../smart
?>
in smarty_conn.php , these are the settings to look into
$smarty->template_dir = MY_DIR.'templates';
$smarty->compile_dir = MY_DIR.'templates_c';
$smarty->config_dir = MY_DIR.'configs';
$smarty->template_dir = MY_DIR.'templates';
$smarty->compile_dir = MY_DIR.'templates_c';
$smarty->config_dir = MY_DIR.'configs';
ASKER
This file does not exist in the version I have. Although the 3 variables are in in the main smarty file but do not work. I think it is an iis permissions thing. any ideas?
hmm i dont think its a permission thing as ur working on windows. what are the values of the
$smarty->template_dir = MY_DIR.'templates';
$smarty->compile_dir = MY_DIR.'templates_c';
$smarty->config_dir = MY_DIR.'configs';
in ur main smarty file ?
if
$smarty->template_dir = MY_DIR.'templates'; is same then the path to ur tpl should be
$smarty->display('index.tp l');
with $smarty->display('../smart y/index.tp l'); ur script is looking for index.tpl on the root folder
can u tell me :
1 : path to ur templates from the root
2 : $smarty->template_dir = MY_DIR.?
3 : the location of ur php script
$smarty->template_dir = MY_DIR.'templates';
$smarty->compile_dir = MY_DIR.'templates_c';
$smarty->config_dir = MY_DIR.'configs';
in ur main smarty file ?
if
$smarty->template_dir = MY_DIR.'templates'; is same then the path to ur tpl should be
$smarty->display('index.tp
with $smarty->display('../smart
can u tell me :
1 : path to ur templates from the root
2 : $smarty->template_dir = MY_DIR.?
3 : the location of ur php script
ASKER
I my smarty.class.php I have variables
var $template_ = 'templates';
var $compile_ = 'templates_c';
var $config_ = 'configs';
which are part of the smarty class. My structure is this
smarty is the top folder
then I have files
smarty compiler class
config file class
smarty class
also in the same directory (smarty) I have the 3 folders
'templates' - caontains index.tpl
'templates_c';
'configs';
'internals'
'pluggins'
I have also moved the basic index.php file into this smarty folder and now it points to
$smarty->display('template s/index.tp l');
This should all be ok but now I get this error
Call to undefined function name()
var $template_ = 'templates';
var $compile_ = 'templates_c';
var $config_ = 'configs';
which are part of the smarty class. My structure is this
smarty is the top folder
then I have files
smarty compiler class
config file class
smarty class
also in the same directory (smarty) I have the 3 folders
'templates' - caontains index.tpl
'templates_c';
'configs';
'internals'
'pluggins'
I have also moved the basic index.php file into this smarty folder and now it points to
$smarty->display('template
This should all be ok but now I get this error
Call to undefined function name()
move the file index.php on the root and change
$smarty->display('template s/index.tp l');
to
$smarty->display('index.tp l');
should work
$smarty->display('template
to
$smarty->display('index.tp
should work
ASKER
Warning: main(C:/Inetpub/wwwroot/Sm arty/libs/ Smarty.cla ss.php) [function.main]: failed to open stream: Permission denied in c:\Inetpub\wwwroot\ssn\6.p hp on line 5
Fatal error: main() [function.require]: Failed opening required 'C:/Inetpub/wwwroot/Smarty /libs/Smar ty.class.p hp' (include_path='.;C:\php5\p ear') in c:\Inetpub\wwwroot\ssn\6.p hp on line 5
Have given it another go. This is the error now seems like windows has it locked or something.
Fatal error: main() [function.require]: Failed opening required 'C:/Inetpub/wwwroot/Smarty
Have given it another go. This is the error now seems like windows has it locked or something.
hmm i think ur getting that error as ur trying to access a file outside ur sites root directory. which is 'ssn' i think? i think if u want to use smarty with that site in IIS , you should put hte smarty directory in ssn , rather than having it in seperate directory/site.
i am not too sure about the IIS config but i think it works but creating sites with virtual directories , so from what i can see 'ssn' and 'smarty' are 2 different sites and thats why its giving you the permission error , as u cannt access files in other sites.... thats my understanding of the situation , may be someone else can shed some more light on that issue.
i am not too sure about the IIS config but i think it works but creating sites with virtual directories , so from what i can see 'ssn' and 'smarty' are 2 different sites and thats why its giving you the permission error , as u cannt access files in other sites.... thats my understanding of the situation , may be someone else can shed some more light on that issue.
ASKER
now getting the following so think have solved the other problem at least.
Warning: Smarty::_parse_resource_na me(C:/Inet pub/wwwroo t/ssn/Smar ty/interna ls\core.ge t_include_ path.php) [function.-parse-resource- name]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\ssn\Sma rty\libs\S marty.clas s.php on line 1650
Fatal error: Smarty::_parse_resource_na me() [function.require]: Failed opening required 'C:/Inetpub/wwwroot/ssn/Sm arty/inter nals\core. get_includ e_path.php ' (include_path='.;C:\php5\p ear') in C:\Inetpub\wwwroot\ssn\Sma rty\libs\S marty.clas s.php on line 1650
Warning: Smarty::_parse_resource_na
Fatal error: Smarty::_parse_resource_na
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
on a side note , for development stuff with php , u should use apache as ur webserver instead of IIS on which u will most of the time have the path problems.