PDA

View Full Version : Help getting variables in showthread template


st@rsky
03-10-2011, 09:13 AM
Hi there

I need help getting the posted by username / time / date variables in the showthread template. I can access all of these variables in the postbits template by using the following vaiables -

> $post[username]
> $post[posttime]
> $post[postdate]

I need to access these variables in the showthread template - can anybody help?

thanks in advance.

kh99
03-10-2011, 11:30 AM
I'm not sure what you mean. There's only one post associated with each use of the postbit template, but there may be many posts on the showthread page.

st@rsky
03-10-2011, 02:02 PM
Well I have a title block in the showthread template, where I would like to display the posters username, the time of the post and the post date. I know the variables above are post specific, but is there a way of getting the initial post information (first post in list) into the showthread template? Does VB have standard variables for this like $thread[posted_by] / $thread[posted_time] ect?

Thanks in advance!

Boofo
03-10-2011, 02:07 PM
Have you tried:

> $postinfo[username]
> $postinfo[posttime]
> $postinfo[postdate]

or

> $thread[username]
> $thread[posttime]
> $thread[postdate]

or

> $threadinfo[username]
> $threadinfo[posttime]
> $threadinfo[postdate]

st@rsky
03-10-2011, 03:06 PM
@Boofo I tried all the the above and none of those variables worked in the showthread template.. I use $thread[title] to pick up the title of the thread so I can't understand why other $thread[] variables don't work! Do you think a hack would be needed?

Lynne
03-10-2011, 03:51 PM
*Exactly* what did you put into the SHOWTHREAD template that didn't work? $threadinfo is the correct variable.

st@rsky
03-11-2011, 08:02 AM
Ok I am using this code in showthread -



<div id="page_title">
<h1>$thread[title]</h1>
</div>
<div class="secondary_info">
<span class="the_post_date">Posted by $threadinfo[username] on
<if condition="!$show['announcement']">
$threadinfo[postdate]<if condition="!$show['detailedtime']">, $threadinfo[posttime]</if>
<else />
<phrase 1="$post[startdate]" 2="$post[enddate]">$vbphrase[x_until_y]</phrase>
</if>
/ <b>37 replies</b></span>
<span class="facebookBut">
<fb:like href="#" layout="button_count" show_faces="false" width="350" action="recommend" font="tahoma" class="fb_like_but"></fb:like>
</span>
</div>



The $thread[title] variable works, but the others do not.

Lynne
03-11-2011, 03:38 PM
As already explained, $post will NOT work in the SHOWTHREAD template. You will need to use $thread or $threadinfo. Also, take a look at the thread table to find out what the variable names are. postdate is not a field in the thread table - dateline is the field that holds the first post date and lastpost is the field that holds the last post date.

st@rsky
03-15-2011, 10:03 AM
I have tried:


Posted by $threadinfo[username] on $threadinfo[dateline], $threadinfo[lastpost]


and:


Posted by $thread[username] on $thread[dateline], $thread[lastpost]


And still it does not work - I am going to look at the thread table variables to see if I can work it out, thanks for your help.

kh99
03-15-2011, 01:41 PM
Did you try $threadinfo[postusername] ?