Because I can't see if someone allready replied via email, i do it in this forum. BTW you get an email for each reply to your post ...
First of all there is a technique called templates in PHP (I use fastTemplate for example), but if you are new to PHP i think this might make your life harder instead of easier... if you played for some month PHP then fastTemplate is a thing you can understand, put to use and see the benefit you gain from it 🙂
So lets do it the classic way g I guess you've been on www.php.net (the holy manual page, I strongly recommend to use the online manual, because of the user notes!). If you are looking for tutorials you find them on this page (phpbuilder), and on www.devshed.com ... Ofcourse there are tons of tutorials on different pages, but can't remember them all. If you need scripts (but be warned, nearly all PHP developers that share their scripts with the rest of the world are to lazy to document them, most of the time its easier to write your own script 🙁 ), you should have a look at www.hotscripts.com and php.resourceindex.com ...
to your task:
Ofcourse there are a lot of different ways you can get what you want, I would suggest the following (no guarantee that its the best). You have your page, instead of the phpinfo(), echo a string containig your dynamic content, sort of:
<?php
echo $sDynamicHTML;
?>
now save this file (I'll assume templ.dbd.php as the filename but its up to you...) and you have your template ...
Lets have a look at first page to use it, your home (or index.php). In this script you collect all the information you need, and build the HTML around it (ofcourse you only build the HTML that you want inside your template). Example:
index.php:
<?php
//Just to have some content, ofcourse you can take the content from a file or a database, but I can't cover all of the nice things you can do with php 🙂
$sNews= 'Now this page is powered by the amazing script language PHP, its so cool I cant believe it 🙂';
$sDynamicHTML='<TABLE WITDH="400" HEIGHT="200" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD HEIGHT="50"> </TD>
<TD ALIGN="CENTER" HEIGHT="50"><FONT COLOR="#FFFFFF" FACE="Verdana, Arial, Helvetica, sans-serif"><B><FONT SIZE="+4">NEWS</FONT></B></FONT></TD>
<TD HEIGHT="50"> </TD>
</TR>
<TR>
<TD WIDTH="20"> </TD>
<TD>
<FONT FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FFFFFF">';
$sDynamicHTML.=$sNews;
$sDynamicHTML.=' </FONT>
</TD>
<TD WIDTH="20"> </TD>
</TR>
</TABLE>';
include_once(./templ.dbd.php);
?>
Thats it ! To exlain a few things: the ' is "stronger" as the ", anything between the ' ' is treated as a string, so you can't put variables inside it or special signs like the linebreak (\n), but its perfect for HTML Code, because you don't have a ' inside HTML ... if you put JS inside such a string you must escape the JS ' (\')... but thats going to far for now.
You see that you can spawn a string over as much lines as you want, the string ends at the closing ' .
And the .= means that you attach the new value to the old value of the variable, $var1.=var;2 is a shorter version of $var1=var1.var2;
And what happens inside this script ? Well you collect the information you want to display (in this case the $sNews string, but you can collect any content you like, forum, guestbook, articles, weather, player ranking ...). After that you build the HTML you want to place inside your template (thats the string $sDynamicHTML). Now you include your template, and the include does the rest of your work, it interprets the file so it'll replace the echo $sDynamicHTML with the HTML Code you defined as $sDynamicHTML and throws it to the Browser ...
Hope that helps and if you have any questions, just ask or write an email ...
cya Rob