vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Help getting variables in showthread template (https://vborg.vbsupport.ru/showthread.php?t=260151)

st@rsky 03-10-2011 09:13 AM

Help getting variables in showthread template
 
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:

Quote:

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

Quote:

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

Quote:

> $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 -

Code:


<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:

Code:

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

Code:

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] ?


All times are GMT. The time now is 09:28 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01575 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete