Forum Moderators: coopster
I've been working with most of the PHP basics but I've never done a FULL php site although I have created individual static pages with “pictures” this time I need to build two webs: one where I can share pictures and videos and another one to compare text. I picture the webs with a header, a left column and a header where the body will display information, pictures and or video (no streaming video). In the past the webs I did have the same code over and over for the header and the footer because I did not know how to use frames or the way to have those two elements in all my pages so this time I want to do it more efficient.
My code looks like this:
foreach ($results as $bl) {
echo "<TR>";//Open Line
echo "<TD><FONT FACE= Verdana ><LI> " . $bl['Fl'] . "</FONT></TD>";//Col 1
if (round(($bl['Prc']),2) >= 40) {$PCOLOR = '#FF0000';} else {$PCOLOR = '#04B404';}
echo "<TD><FONT FACE= Verdana COLOR=" . $PCOLOR . ">" . round($bl['Prc'],2) . "%</FONT></TD>";//Col 2
echo "<TD><FONT FACE= Verdana COLOR=#FFFFFF><a href=" . $bl['Lnk'] . " target=_blank>" . $bl['SLnk'] . "</a></TD>"; //Col 3
//echo "Link string: " . $bl['Lnk']; echo "<br/>";
//echo $bl['SLnk']; echo "<br/>";
echo "</TR>";
}
This takes me long time and is tedious may be it's unnecessary so I contact a good friend of mine that knows pretty much about this and he advice to:
“Create a couple of template and then use variables to build your pages this can be done with one line of PHP code”
I believe he show me that line of code in PHP that some one publish in this forum somewhere. My goal is not to accomplish this with one line of code but to do it the most efficient way possible.
So, I’m looking for advice and examples of how to accomplish this like the "best practices" or pointing me to the right direction.
If there's a site that anyone can point me to, like "best php practices” that could show me examples about all this stuff? How can I start this task? What are the very best, most efficient ways of doing what I desire to do?
Thanks in advance
jj
we have a couple threads that will help in our library [webmasterworld.com]
A dynamic site in 2 minutes [webmasterworld.com]
The One Line Template Engine! [webmasterworld.com]