Wednesday 06 April 2005 6:46:53 pm
Before I start, note that I have not really tried what you are doing. My understanding, which may be wrong, is the following: <b>Wrong</b>
function calledFromTemplate()
{
echo "<b>hello</b> dude!";
}
function calledFromTemplate2()
{
?>
<b>hello</b> dude!
<?php
}
<b>Right</b>
function calledFromTemplate()
{
return "<b>hello</b> dude!";
}
function calledFromTemplate2()
{
ob_start();
echo "<b>hello</b> dude!";
return ob_get_clean();
}
function calledFromTemplate3()
{
ob_start();
?>
<b>hello</b> dude!
<?php
return ob_get_clean();
}
And finally, what I am guessing you want to do:
function include_my_php()
{
ob_start();
include("myFile.php");
return ob_get_clean();
}
I am not familiar enough to know if the following problems will give you trouble:
1) Your included file probably outputs <html> and <head> tags that will end up embedded inside the larger eZp document.
2) Your included file will have a much different environment than being called directly (with regards to current directory, $PHP_SELF, etc). 3) If your included file has links, they may not correspond to correct ezp urls. I have no idea how ezp deals with post operations either. I have not tested any of these code snippets. YMMV. Good luck and have fun. BTW, if you get it working, let me know, I may have a use for something similar :-)
|