hamza Posted November 17, 2009 Share Posted November 17, 2009 this is how i am assigning file list.php contents in content variable to include in main template $arr = array(1000, 1001, 1002); $smarty->assign('myArray', $arr); $smarty->assign('pageTitle', 'Admin Control Panel - View Categories bhai jan'); $smarty->assign('content', 'list.php');//'list.php' list.php file code is below {* simple loop to display integers *} {foreach from=$myArray item='foo'} {$foo} {/foreach} including file dynamically using content variable <div id="main"> {include_php file="$content"} </div> Problem is that when file is include with contents of smarty but not running it . output is look like follow the link below http://76.163.166.217/hamza/phpblog/phpblog/admin/catagory/ all paths are included perfectly Link to comment https://forums.phpfreaks.com/topic/181813-smarty-file-include/ Share on other sites More sharing options...
zeodragonzord Posted November 23, 2009 Share Posted November 23, 2009 {include_php} is deprecated, so you probably should avoid using it. Not sure if that's what's causing the problem though. Is the code from the third code block in a separate file thank the first two code blocks? Do this, rename the list.php file to list.tpl. On the third code block, change it to: <div id="main"> {include_file="$content" myArray=$myArray} </div> On the first code block, change 'list.php' to 'list.tpl.' Link to comment https://forums.phpfreaks.com/topic/181813-smarty-file-include/#findComment-964124 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.