Forum Moderators: coopster

Message Too Old, No Replies

Template var Help

         

amwd07

1:54 pm on Aug 22, 2007 (gmt 0)

10+ Year Member



Hello here is my current page all I am trying to do is use includes instead of writing what $main = this is a template varible in template.php the speech marks must be wrong and without them the page fails, anyone any idea's?

<?php

$site_title = "Restaurants, Pubs, Places to Eat, Food & Drink Dine with us";
$page_title = "TEST";

$main = "include('dining_include.php')"; (This is where I'm stuck)

require('include/nav2.php');

$template = file_get_contents('include/template.php');

$search = array('¦{PAGE_TITLE}¦',
'¦{MAIN_MENU}¦',
'¦{MAIN}¦'

);
$replace = array("$site_title - $page_title",
$main_menu,
$main,

);

$output = preg_replace($search, $replace, $template);

echo $output;
?>

dreamcatcher

6:21 pm on Aug 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi amwd07,

Pop the following after your opening php tag:

error_reporting(E_ALL);

See if that throws an error.

I think you would be better off using file_get_contents [php.net] to read your template file as you have with your other file.

$main = file_get_contents('dining_include.php');

dc

amwd07

9:59 pm on Aug 22, 2007 (gmt 0)

10+ Year Member



I have tried that but it does not see to show up the php code within the includes there are also 3 other includes inside dining_include.php?