Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

PHP include in a Smarty Template

Status
Not open for further replies.

Admin

Administrator
Staff member
Joined
Jun 14, 2004
Posts
11,071
Reaction score
951
Hi,

Does anyone know how to include a PHP file inside a Smarty template?

1, I create the PHP file, it works fine
2, Empty TPL file except for {include_php file="path and filename of PHP file"}

3, main page
Code:
<?
session_start();
 //includes
 require("includes/globals.php");
    //assign smarty variables
    $smarty->assign("page_title","[I]title[/I]");
    $smarty->assign("page_content","[I]TPL file with PHP include[/I]");
    $smarty->display("template.tpl");
?>

The page appears with the correct template but the PHP page content does not appear, instead I get the error:

Warning: Smarty error: pathandfilename.php is not readable in /home/name/public_html/smarty/libs/Smarty.class.php on line 1095

Any ideas anyone?

Thanks

Admin
 
sure you are using the correct file path?

your include line should look like this:

{include_php file=$page_content}
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

Latest Comments

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom