PDA

View Full Version : need a little php help with conditions.


Fou-Lu
10-11-2002, 12:36 PM
Once again, this is for a vbulletin. I like allowing my users to choose there post color, but am finding it very difficult to read some of there posts. I haven't perfected the insertion to the DB yet, but I have added a column, themetext, where the information is stored like so:
1|||#000000
4|||#000000
5|||#FFFFFF

The numbers are the styleids. Anyway, here is where I am having some problems:


while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) {
if ($postdone[$post[postid]]) {
$counter--;
continue;
} else {
$postdone[$post[postid]]=1;

$splitthemes = split("\n", trim($post[themetext]));
while (list($key,$val)=each($splitthemes)) {
$theme = split("\|\|\|", $val);
$theme[style]= $theme[0];
$theme[value]= $theme[1];
if ($usersstyle == "$theme[style]"){
$post[fontcolor] = "$theme[value]";
}else{
$post[fontcolor] = "#000000";
}
}
}
$postbits .= getpostbit($post);
}


I have added a part for $usersstyle, that is either there set style, or their session style. That part works fine. The problem is, I can only get this to work on the 5th theme, which is the last entry to the db. I have also noticed that if I change it so that the 4th theme is the last one, that the fourth one is the only one this works on. Is this just a simple loop problem? Please help me!

Also, the forums striped it. Where it says:
$theme = split("\|\|\|", $val);
It has backslashes in front of all of the pipe bars. \|\|\|

Nightfire
10-11-2002, 02:19 PM
If it's for VB, you're best asking at http://www.vbulletin.org That's the official hack site for VB

Fou-Lu
10-11-2002, 11:57 PM
Yeah, thanks for pointing that out. Problem being though, that I am the co-administrator, and the forums are owned by the other admin. I don't have the customer id's and codes, so they ignore me there. That is why I come here :)