View Full Version : link to message to-which-this-in-reply


darnoldy
29th November 2004, 09:43 PM
Folks-

what I am trying to do is to build a link into postings that will display the message to which the current message is a reply.

vBuletin must keep track of which message that is--else thread trees couldn't be built.

I found this line of code that will open the current message in a new window:

<a href="showpost.php?$session[sessionurl]p=$post[postid]&amp;postcount=$post[postcount]" target="new">
<strong>$post[postcount]</strong>
</a>

What I can't find is a variable that holds the message to which this in reply.

help please!

--don

buro9
30th November 2004, 01:44 AM
Try parentid:

<a href="showpost.php?$session[sessionurl]p=$post[parentid]" target="new">Parent</a>

That should do it.

Though you'll need to edit the post query and join to fetch that posts title, but you have the ID of the post, and that's enough to create the link :)

darnoldy
30th November 2004, 02:37 AM
Try parentid

Kewl!

That's what i was looking for...

(off to edit some template.)

--don

darnoldy
30th November 2004, 03:08 AM
<a href="showpost.php?$session[sessionurl]p=$post[parentid]" target="new">Parent</a>

Works just swell. However, the first message in a thread displays a parentid of 0--which takes the userf to an error page. This is right, since it has no parent. However, i want to wrap it in a conditional that will not display the link for the first message of a thread.

I tried:
<if condition="parentid">
&nbsp; (reply to message #
<a href="showpost.php?$session[sessionurl]p=$post[parentid]" target="new">$post[parentid]</a>)
</if>


which seems to always test TRUE....

I also tried:
<if condition="parentid >0">

which seems to always test FALSE.

Any suggestions?

--don

buro9
30th November 2004, 08:34 AM
Your test is wrong... parentid is part of the post array... you may want something like:

<if condition="$post[parentid] != '' && $post[parentid] > 0">
&nbsp; (reply to message #
<a href="showpost.php?$session[sessionurl]p=$post[parentid]" target="new">$post[parentid]</a>)
</if>


But give it a try as my conditionals are rusty and I don't know what that value holds for things like the PM page.

darnoldy
30th November 2004, 09:08 AM
buro9-

Your test is wrong...

I'm not surprised... I've been pretty-much working in the dark here--cutting and pasting for the most part.

Your suggestion worked.

Thank you

--don