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. \|\|\|
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. \|\|\|