how to make php script within a php variable to work?
Posted: Sun Jan 22, 2006 1:02 am
Considered the following sample php files.
Example File 1 (file1.php) -- some programming script (actually more complicate than this, it is used to retrieve XML codes and displaying them)
Example File 2 (index.php) - the running page
File 3 (file3.php) --- considered as the template
I couldn't get to display the contents retrieved from file1.php and displaying them in the running page. I could but them into 1 file, which works perfectly, but I wouldn't like to have all the pages to have repeated codes especially the template codes. I think the problem lies in the index.php.
Can some1 help me?
Example File 1 (file1.php) -- some programming script (actually more complicate than this, it is used to retrieve XML codes and displaying them)
Code: Select all
<?
echo "This is a test!";
?>Code: Select all
<?
$getinclude = get_include_contents('file1.php');
$body = "<tr><td>".$getinclude."</td></tr>"
include('file3.php');
?>Code: Select all
<html>
......
The normal HTML opening tags
......
<?php
print $body;
?>
......
The normal HTML closing tags
......
</html>Can some1 help me?