Llama!
Junior Member
Posts: 87
|
Post by Llama! on Sept 9, 2005 15:34:36 GMT
Hello. Are you tooooo bored of keep adding extra tables. Keep writing all the <table><tr><td></td></tr></table> over and over? This tut will help you that you only have to do it LESS!!! We make use of a function that starts and ends a table. First let's make a function that makes the start of the table+title: <?php function table($title) { echo "<table width=\"100%\" style=\"border:1px solid #000000;\" cellspacing=\"0\"><tr><td style=\"border-bottom: 1px solid #000000;\">".$title."</tr></td><tr><td>"; } ?> That is a function that will add the starting rable + title ALL the time. Now leet's make the function that closes it: <?php function table($title) { echo "<table width=\"100%\" style=\"border:1px solid #000000;\" cellspacing=\"0\"><tr><td style=\"border-bottom: 1px solid #000000;\">".$title."</tr></td><tr><td>"; }
function endtable() { echo "</td></tr></table>"; } ?> Now we made it, and now let's test it <?php function table($title) { echo "<table width=\"100%\" style=\"border:1px solid #000000;\" cellspacing=\"0\"><tr><td style=\"border-bottom: 1px solid #000000;\">".$title."</tr></td><tr><td>"; }
function endtable() { echo "</td></tr></table>"; }
table("The title"); //this will open the table wich will have the title: The title echo "This is within the table LOL!!!"; //the text in the table. endtable(); //stops the table ?> That was it Hope you understand, if not give a shout!
|
|