jacobomoya
05-13-2010, 09:54 AM
Hi, I'm trying to program a simple plugin to change the info shown in the author field of the threadbit in certain forums, yet I'm encountering a very silly problem.
Maybe it's not the best practice but what I did was set a placeholder comment in the template where the desired condition is met, which is then replaced with the plugin (when I only make changes in the template everything works fine, but I need to use PHP), I'll try to optimize it when I get it to work. So as a very simple test, I tried to show the thread title again in the author field, this is the plugin right now:
if ($thread['forumtitle']=='Logros')
{
$origen1="<!-- Logro_Descripcion -->";
$destino1="<div class='author'>".$thread['threadtitle']."</div>";
$threadbit=str_replace($origen1,$destino1,$threadb it);
}
Then this happens:
http://img195.imageshack.us/img195/3932/threadbitproblem.png
The $thread variable seems to be picking the data from the NEXT thread. It works fine when I set in the template to show the threadtitle instead of the author there but my intentions is to use the php function to explode the thread[preview] string and show part of it in the author field and replies field.
I hope it was a clear explanation. Could someone explain to me why is this happening and what could I do? Thanks.
Maybe it's not the best practice but what I did was set a placeholder comment in the template where the desired condition is met, which is then replaced with the plugin (when I only make changes in the template everything works fine, but I need to use PHP), I'll try to optimize it when I get it to work. So as a very simple test, I tried to show the thread title again in the author field, this is the plugin right now:
if ($thread['forumtitle']=='Logros')
{
$origen1="<!-- Logro_Descripcion -->";
$destino1="<div class='author'>".$thread['threadtitle']."</div>";
$threadbit=str_replace($origen1,$destino1,$threadb it);
}
Then this happens:
http://img195.imageshack.us/img195/3932/threadbitproblem.png
The $thread variable seems to be picking the data from the NEXT thread. It works fine when I set in the template to show the threadtitle instead of the author there but my intentions is to use the php function to explode the thread[preview] string and show part of it in the author field and replies field.
I hope it was a clear explanation. Could someone explain to me why is this happening and what could I do? Thanks.