1

Topic: Possible to help to "recode" viewtopic.php ?

I saw this on ABBA official Website (I love ABBA)
http://www.abbasite.com/forum/thread.php?t=37649

And I think it's very cool : the topic is separated from the answers, and I like very much the layout. Possible to have this ? Thanx for your help smile

2

Re: Possible to help to "recode" viewtopic.php ?

I also like the idea of the first post in a thread being different from the replies. The semantics also sort of make sense though I do think that duplicating the topic at the start of every page of a multipage thread is overkill. You will be able to produce a similar layout in 1.3 just using the stylesheet. You can almost do it in 1.2 but you would need to add a couple of lines into viewtopic. Thats a good style for PDA's and any narrow layout.

If you mean having the forum listing permanently on display as a sidebar, thats a different thing alltogether and won't be possible.

3 (edited by wenzlerpaul 2006-03-02 19:36)

Re: Possible to help to "recode" viewtopic.php ?

Hi,

I actually tried this approach (and it worked for me) and the way I think (at least in my own opinion) is to flag the first post with a switch, add a column in your table say first_post INT 1 and default 0,

then on your post.php, create something like below (notice the $first variable)

                // Create the post ("topic post")
                $first = '1';
                $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id, first_post) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$new_tid.', '.$first.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
            }

when the first post is created, it is automatically flagged 1, then you can call it with a seperate WHERE first_post=1 in your viewtopic.php file, echo the results in a different div tag on top of the loop that produces all post..., to remove the first post on the rest pof the post, issue a WHERE first_post=0 to fetch all other remaining posts...

The other way of doing this is to select distinct your post table WHERE topic_id = (youridhere) then get the oldest post by limit 1 in "posted" field... this will likely get the oldest post which is actually the first posted message...

echo your results on top of the loop that produces the threads...

I hope it helps.... (and hope it does makes sense hehehe)