PDA

View Full Version : Passing Variables Around


led_belly
03-02-2006, 01:39 AM
Hi All,

I have created a new page of the type PHP File. I want to be able to pass variables in the PHP file up into bits of templates (assigned to variables). I've been playing with eval() but I can't seem to get anything to print out... Do I need to add the variables to the global scope somehow? I was looking at the modules/navigation.php file as an example but couldn't seem to replicate its successes.

Any help appreciated ;-)

led_belly
03-02-2006, 07:10 PM
Ok, so I think I have a few answers but still not getting output...

In the included PHP file I have the following test code:

<?php

$subject = 'Hello World!';
eval('$deals = "' . fetch_template('dealbits') . '";');
eval('$home["$mods[modid]"][\'content\'] = "' . fetch_template('adv_portal_deals') . '";');

//die(print_r($home));
?>

The dealsbits template just has '$subject' in it and adv_portal_deals has '$deals'. When I refresh the page nothing appears. If I uncomment the die() line the right content is present. Any ideas?