Link to home
Start Free TrialLog in
Avatar of erwingosepa
erwingosepa

asked on

PHP error message

I.m getting the following error php error:
PHP Warning: Smarty::include(include/smarty/templates_c\%%45^45E^45E480CD%%index.tpl.php) [function.Smarty-include]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1258 PHP Warning: Smarty::include() [function.include]: Failed opening 'include/smarty/templates_c\%%45^45E^45E480CD%%index.tpl.php' for inclusion (include_path='.;c:\php\includes;C:\Inetpub\wwwroot\WEBPORTAL\include\smarty') in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1258

// the index.php file is:
<?php
require_once('c:/Inetpub/wwwroot/WEBPORTAL/include/smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = 'include/smarty/templates';
$smarty->compile_dir = 'include/smarty/templates_c';
$smarty->cache_dir = 'include/smarty/cache';
$smarty->config_dir = 'include/smarty/configs';
$smarty->assign('name','Ned');
//** un-comment the following line to show the debug console
$smarty->debugging = true;
$smarty->display('index.tpl');
?>

// the index.tpl

<html>
<head>
<title>Smarty</title>
</head>
<body>
Hello, {$name}!
</body>
</html>
Avatar of Vel Eous
Vel Eous

The warning is informing you that the file "index.tpl.php" cannont be found in that directory.

Your page is named index.tpl, but somewhere in your code (perhaps on another page) instead of including index.tpl, you are trying to include "index.tpl.php".

Check the file named Smarty.class.php and look in line 1258.  That is where the error is pointing you to.
Avatar of erwingosepa

ASKER

Now I'm getting the following:
PHP Warning: Smary error: unable to read resource: "index.tpl" in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1095

the index.tpl is in the templates directory.

Redefine compile_dir as global (i.e. based of C:/).
Redefine compile_dir as global (i.e. based of C:/). does not work.
Tchuki:The warning is informing you that the file "index.tpl.php" cannont be found in that directory.

The file in the directory is "index.tpl" not index.tpl.php.
Where is taking the "index.tpl.php" then?
index.tpl is your original Smarty template. The warning shows that it can't find the COMPILED template that is created by Smarty in your .../templates_c directory. Compiled templates are actually PHP files, and Smarty creates a random name and appends .php to it.

It could be as easy as the compile directory not being set as writeable by your webserver - hence Smarty can't compile your tpl and then include the compiled .php.
if the statement mention above is true then I have problems with compiling. I checked the the directory in IIS and it has read and write permissions.
This is the eror that I get now. the debugging is set to true.

PHP Warning: Smarty::include(c:/Inetpub/wwwroot/WEBPORTAL/include/smarty/templates_c/\%%6D^6D7^6D7C5625%%test.tpl.php) [function.Smarty-include]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1258 PHP Warning: Smarty::include() [function.include]: Failed opening 'c:/Inetpub/wwwroot/WEBPORTAL/include/smarty/templates_c/\%%6D^6D7^6D7C5625%%test.tpl.php' for inclusion (include_path='.;C:\php5\pear') in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1258 PHP Warning: Smarty::include(c:/Inetpub/wwwroot/WEBPORTAL/include/smarty/templates_c/\%%5F^5FE^5FE30B84%%debug.tpl.php) [function.Smarty-include]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1925 PHP Warning: Smarty::include() [function.include]: Failed opening 'c:/Inetpub/wwwroot/WEBPORTAL/include/smarty/templates_c/\%%5F^5FE^5FE30B84%%debug.tpl.php' for inclusion (include_path='.;C:\php5\pear') in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1925
ASKER CERTIFIED SOLUTION
Avatar of m1tk4
m1tk4
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial