got a template with this preload_replace:
{preload_replace:file_dir="http://mysite.com/directory.php?file_dir=/files/"}And called like this in my template:
<?php
echo file_get_contents({file_dir});
?>However, I get this error:
Parse error: syntax error, unexpected ':' in expressionengine/libraries/Functions.php(640) : eval()'d code...How do I fix this? I have my template preferences set to Allow PHP and PHP Parsing Stage= Output.
What exactly is that URL and what does it return if you just visit it by itself in a browser?
I just tested this code :
{preload_replace:my_variable="http://www.google.com"}
<?php
$homepage = file_get_contents('{my_variable}');
echo $homepage;
?>and it all seemed to work fine so I’m just wondering if it’s perhaps something to do with what you’re trying to feed into the variable maybe?
Best wishes,
Mark
If I use the url
http://mysite.com/directory.php?file_dir=/files/in the browser, it returns the exact html I want to show.
If I modify the directory script back to it’s original code that had the path to opendir() hardcoded to ‘/files/’ , then this works exactly as planned:
<?php
echo file_get_contents("http://mysite.com/directory.php");
?>Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.