|
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 |
mhdn2 Smarty Rookie
Joined: 12 Aug 2015 Posts: 11
|
Posted: Mon Oct 19, 2015 1:18 am Post subject: INCLUDE_PHP throwing "file not readable" error |
|
|
I'm trying to use INCLUDE_PHP as a band-aid until I get all my pages converted to Smarty. However it keeps throwing this error.
Code: | Notice: Undefined property: SmartyBC::$trusted_dir in /home/clansta/public_html/iascripts/smarty/Smarty.class.php on line 1681
Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "skins/nos1/claninfo.html" on line 7 "{INCLUDE_PHP file=$menu_path}" {include_php} file 'menu.php' is not readable <-- thrown in /home/clansta/public_html/iascripts/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 7 |
My viewer files are in the top level directory iascripts, and my Smarty HTML files are a couple of levels lower in iascripts/skins/nos1 (or in the future, whatever folder corresponds to the chosen skin)
Viewer File
/iascripts/claninfo.php
Code: | <?php
$skin_path = 'skins/nos1/';
include('./smarty/Smarty.class.php');
// temporarily using SmartyBC instead of Smarty to enable {INCLUDE_PHP}
$smarty = new SmartyBC();
$smarty->setTemplateDir($skin_path);
$smarty->setCompileDir('./smarty/templates_c');
$smarty->setCacheDir('./smarty/cache');
$smarty->setConfigDir('./smarty/configs');
$smarty->assign('menu_path', '../../claninfo/menu.php');
$smarty->assign('page_path', '../../claninfo/index.php');
$smarty->display('claninfo.html');
?> |
Smarty Code
/iascripts/skins/nos1/claninfo.html
Code: | {INCLUDE_PHP file=$menu_path}
{INCLUDE_PHP file=$page_path} |
Files we're trying to include:
/iascripts/claninfo/index.php
/iascripts/claninfo/menu.php
Clearly I am doing something wrong. Please take a look and see if you can steer me in the right direction. Thank you. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
Back to top |
|
mhdn2 Smarty Rookie
Joined: 12 Aug 2015 Posts: 11
|
Posted: Sat Oct 31, 2015 7:47 pm Post subject: |
|
|
I changed my Smarty code to this:
Code: | include('./smarty/SmartyBC.class.php');
$smarty = new SmartyBC();
$smarty->trusted_dir = array('/');
$smarty->enableSecurity(); |
I am still getting the error:
Code: | Notice: Undefined property: SmartyBC::$trusted_dir in /home/clansta/public_html/ics/smarty/Smarty.class.php on line 1702
Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "skins/nos1/claninfo.html" on line 7 "{INCLUDE_PHP file=$menu_path}" {include_php} file 'menu.php' is not readable <-- thrown in /home/clansta/public_html/ics/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 7 |
I also get the same error with this simpler code:
Code: | include('./smarty/SmartyBC.class.php');
$smarty = new SmartyBC(); |
Any suggestions? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Oct 31, 2015 9:39 pm Post subject: |
|
|
Start using full paths. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Oct 31, 2015 9:52 pm Post subject: |
|
|
mhdn2 wrote: | I changed my Smarty code to this:
Code: | include('./smarty/SmartyBC.class.php');
$smarty = new SmartyBC();
$smarty->trusted_dir = array('/');
$smarty->enableSecurity(); |
|
You can not add a property to the Smarty class like this
Code: | $smarty->trusted_dir = array('/');
|
You must add the property to SmartyBC.class.php
Code: | public $trusted_dir = array(.....); |
as I told you before. |
|
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
|