Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-10-2011, 09:13 AM
st@rsky st@rsky is offline
 
Join Date: Feb 2006
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 03-10-2011, 11:30 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 03-10-2011, 02:02 PM
st@rsky st@rsky is offline
 
Join Date: Feb 2006
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #4  
Old 03-10-2011, 02:07 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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]
Reply With Quote
  #5  
Old 03-10-2011, 03:06 PM
st@rsky st@rsky is offline
 
Join Date: Feb 2006
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@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?
Reply With Quote
  #6  
Old 03-10-2011, 03:51 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*Exactly* what did you put into the SHOWTHREAD template that didn't work? $threadinfo is the correct variable.
Reply With Quote
  #7  
Old 03-11-2011, 08:02 AM
st@rsky st@rsky is offline
 
Join Date: Feb 2006
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 03-11-2011, 03:38 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 03-15-2011, 10:03 AM
st@rsky st@rsky is offline
 
Join Date: Feb 2006
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 03-15-2011, 01:41 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you try $threadinfo[postusername] ?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:14 PM.


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.04225 seconds
  • Memory Usage 2,250KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete