Hiya, I bet there is something wrong with this... help!
Posted: Fri Dec 12, 2008 8:17 pm
So, I was trying to do some OOP (note that i am a real noob
) but apparently the php refuses to let it fire... can anyone take a look at it? It might be <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> up and all but, constructive criticism is always appreciated.
EDIT:
Oh, don't know if it makes a difference but here is the code for using the object, maybe there's something wrong with it..
Yeah, I removed the extra ?> but it still wont fire
Code: Select all
class pagebuilder{
// tf = table foundation
var $tf = array();
var $posts;
$tf[1] = "<table class='alltables' cellspacing='0' cellpadding='0'>
<tr align='center'>
<td class='dtl'></td>
<td class='dth'></td>
<td class='dtr'></td>
</tr>
<tr align='center'>
<td class='dlv'></td>
<td>
<table class='alltables' style='border: 1px solid #88b9e2;' cellspacing='0' cellpadding='0'>
<tr>
<td class='dbgc' style='width: 200px; border-right: 1px solid #88b9e2; height: 100px;' rowspan='3' align='center' > <table cellspacing='0' cellpadding='0'>
<tr>
<td align='center'>"; //Name after this line
$tf[2] = "</td>
</tr>
<tr>
<td align='center'><img style='border: 1px solid #88b9e2;' src='"; //image source after this line
$tf[3] = "'></td>
</tr>
<tr>
<td align='center'>"; //rep title and rep points after this line
$tf[4] = "</td>
</tr>
</table>
</td>
<td class='dbgc' style='border-bottom: 1px solid #88b9e2;'>"; //title after this line, if no title make colspan = 2
$tf[5] = "</td>
</tr>
<tr>
<td class='dbgc' align='left' style='border-bottom: 1px solid #88b9e2;'>"; // text after this line
$tf[6] = "</td>
</tr>
<tr>
<td class='dbgc'>"; //signature after this line
$tf[7] = "</td>
</tr>
</table>
</td>
<td class='drv'></td>
</tr>
</table>
<table class='alltables' cellspacing='0' cellpadding='0'>
<tr align='center'>
<td class='dbl'></td>
<td class='dbh'></td>
<td class='dbr'></td>
</tr>
</table>"; //that should do it
function dbrow() {
var $genstring = "";
require("privatefile :P"); // the file connects to a db
$query = "SELECT * FROM sometable";
$r = mysql_query($query);
while($row = mysql_fetch_array($r)){
$genstring = $genstring.$tf[1].$row['name'].$tf[2].$row['img_src'].$tf[3].$row['reptitel']."<br/>".$row['rep'].$tf[4].$row['text_titel'].$tf[5].$row['text'].$tf[6].$row['signatur'].$tf[7];
}
$this->posts = $genstring;
return $this->posts;
mysql_close($link);
}
}
Oh, don't know if it makes a difference but here is the code for using the object, maybe there's something wrong with it..
Yeah, I removed the extra ?> but it still wont fire
Code: Select all
$pager = new pagebuilder();
print $pager->dbrow();