1 (edited by bingiman 2007-02-20 23:06)

Topic: A little boxover help required

I just installed a script called boxover. I am currently trying to use it in the viewforum.php file. It works great and I've tested it on almost every browser. It is also w3c compliant. My problem is this. I am new to punBB and have no idea what I should add in the boxover field to get it to display:

1 - The Subject of the last post
2 - The mesasge body [last post] with a limited amount of text eg: (250 characters)

Here is the area I am trying to work with:
           
           

$subject = '<a title="header=['.pun_htmlspecialchars($cur_topic['subject']).'] body=['.$cur_post['message'].']" href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <br /><span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';

UPDATE: Ok, I managed to get the subject to be displayed but not the actual message. Help!
Any help here would be greatly appreciated.

Thanks
Bingiman

Re: A little boxover help required

You want the top message or the last message posted in that topic? The topic table holds only the subject the the id's and dates. The post table holds the message. If there isn't a db->query nearby with something along the lines of "<stuff> LEFT JOIN posts <stuff>" then look in the viewtopic.php file and see how they access messages from post id's and topic id's.

echo "deadram"; echo; fortune;

Re: A little boxover help required

I have tried it all and nothing works. I am lost!

Re: A little boxover help required

$result=$db->query('SELECT * FROM posts WHERE topic_id=\''.$cur_topic['id'].'\';') or error('Unable to get data from posts table', __FILE__, __LINE__, $db->error());

$last_post = $db->fetch_assoc($result)
while ($cur_post = $db->fetch_assoc($result))
{
  if ($cur_post['posted'] > $last_post['posted'])
    $last_post = $cur_post;
}

// Don't forget to parse for bb code and remove html elements from this post etc... Like I said before, the code to do this in viewtopics.php :P
$lastMessageInThisThread = $last_post['message'];
echo "deadram"; echo; fortune;

Re: A little boxover help required

Where exactly do I have to place the code above in viewforum? I get this error:

Parse error: parse error, unexpected T_WHILE in c:\localsite\viewforum.php on line 147

Bingiman

Re: A little boxover help required

Change

$last_post = $db->fetch_assoc($result)

to

$last_post = $db->fetch_assoc($result);
Looking for a certain modification for your forum? Please take a look here before posting.

Re: A little boxover help required

thanks for the help but I still get errors. I am getting this error:

PunBB reported: Unable to get data from posts table
Database reported: Table 'punners.posts' doesn't exist (Errno: 1146)

I also do not know what variable to use in the body of the above boxover script.

Thanks
Bingiman