1 (edited by rhan 2007-05-22 11:56)

Topic: Display a post on index

Hello,

I would like to display a specific post on my index. I have tried to do it myself and it works on forums pages.
Outside the forum, in the gallery, or a custom php page, it show an error : all to undefined function: parse_message()

Someone can help me to fix that problem ? I want to keep the parsing


Here is the code :

<?php

define('PUN_ROOT', './');

$result = $db->query('SELECT id, message FROM '.$db->prefix.'posts WHERE id=4735') or error('Unable to fetch user data', __FILE__, __LINE__, $db->error());
while ($data = $db->fetch_assoc($result))
{
$data['message'] = parse_message($data['message'], $data['hide_smilies']);
echo $data['message']."\n"    ;
}

 ?>

Thanks a lot !

Re: Display a post on index

You need to include include/parser.php.

Looking for a certain modification for your forum? Please take a look here before posting.

3 (edited by Surkow 2007-09-27 15:16)

Re: Display a post on index

Is there a way to fetch a single post out of a topic? Currently I was only able to fetch the first post with code comparable to the one from the first post of this topic. I intended to use a pid but without avail.

A simple sql query to retrieve a post would be

SELECT message 
FROM posts
WHERE id=3