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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-13-2009, 01:34 PM
columbusgeek's Avatar
columbusgeek columbusgeek is offline
 
Join Date: Sep 2007
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default how to do a conditional element on the postbit

I am involved in a pretty heavy rework of a template. I need to know how to do a conditional element on the postbit.

For example if there is data inserted into a custom field then it will display the title of the custom field and the data, but if there is no data added to the field the title will not be displayed.

suggestions are appreciated.
Reply With Quote
  #2  
Old 02-13-2009, 02:09 PM
Spank Spank is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 809
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
<if condition="$post['field#']">$post[field#]</if>
Be sure to replace the # with the field number.
Reply With Quote
  #3  
Old 02-13-2009, 02:09 PM
UKBusinessLive UKBusinessLive is offline
 
Join Date: Sep 2008
Location: Essex, United Kingdom
Posts: 1,637
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi

You need to add something like this

Code:
<if condition="$post['fieldX']">
whereas the 'fieldx' is the field attribute from the user custom field

Don't forget to end it too

Code:
</if>
--------------- Added [DATE]1234541403[/DATE] at [TIME]1234541403[/TIME] ---------------

Quote:
Originally Posted by Spank View Post
Code:
<if condition="$post['field#']">$post[field#]</if>
Be sure to replace the # with the field number.
SNAP
Reply With Quote
  #4  
Old 02-13-2009, 02:21 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Usually you can get a sense of how to do a condition by looking at others in the same template. In your case, see this one:
HTML Code:
<if condition="$post['field2']"><div>$vbphrase[location_perm]: $post[field2]</div></if>
You should be able to copy that and change field2 to fieldx for your field and then just change the phrase being used also. So....
HTML Code:
<if condition="$post['fieldx']"><div>Whatever: $post[fieldx]</div></if>
edit: Darn, I was late on this one! That's what I get for filling up my tabs in my browser window.
Reply With Quote
  #5  
Old 02-13-2009, 02:52 PM
columbusgeek's Avatar
columbusgeek columbusgeek is offline
 
Join Date: Sep 2007
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for all the great advice, worked perfect.

--------------- Added [DATE]1234544458[/DATE] at [TIME]1234544458[/TIME] ---------------

I think I phrased my question wrong though. I the custom fields I was able to do, but my issues lies with replies to the post.

This is going to sound odd, but I am phrasing this to sound generic, and not necessarily the way it will be implemented on the board.

A user posts a topic. Below the topic area it is totally empty. (no quick reply, no nothing) When a person replies to the topic, text will come up saying "replies to topic below", and obvioulsy, the reply will show.

So it's just a matter of showing or hiding a chunk of text belwo the post, and above the replies, depending upon if there are replies.
Reply With Quote
  #6  
Old 02-13-2009, 03:04 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So you actually need something to show up under the first post in a thread?
Reply With Quote
  #7  
Old 02-13-2009, 03:13 PM
columbusgeek's Avatar
columbusgeek columbusgeek is offline
 
Join Date: Sep 2007
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm the middle man here between the designer so sorry about my slight confusion, but yes, that sounds like the ticket. I think it only needs to be text.
Reply With Quote
  #8  
Old 02-13-2009, 04:23 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just add something like this to the end of the postbit (or postbit_legacy) template (of course, format it correctly). Or use $template_hook[postbit_end] to add it:
HTML Code:
<if condition="$post['postid']==$thread['firstpostid']">
stuff after first post
</if>
Reply With Quote
  #9  
Old 02-13-2009, 05:44 PM
columbusgeek's Avatar
columbusgeek columbusgeek is offline
 
Join Date: Sep 2007
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As always, thank you for your suggestions Lynne, and everybody else for that matter.
Reply With Quote
  #10  
Old 02-14-2009, 03:39 AM
connectr connectr is offline
 
Join Date: Jan 2009
Location: Cape Town, South Africa
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi guys,
I'm the guy working with Matt on this project

What i was trying to figure out, was how to wrap the entire postbits block with a conditional check - if posts exist show postbits block, else show alternate block (or nothing).

<if condition="$post==1>
<div id="posts">
$postbit
</div>
<else/>
<p>There are no posts in this category.</p>
</if>

Hope that clarifies

Thanks again to everyone who took the time to reply - its much appreciated!!

Cheers,
Chris

--------------- Added [DATE]1234590312[/DATE] at [TIME]1234590312[/TIME] ---------------

To further clarify, i've uploaded a screenie of the layout i'm wokring on.. http://www.quicksnapper.com/connectr...load-details2/

Its the download details page in vbdynamic download manager. The postbits section is handled by vb and that is the updates block below the main image (i have pretty much stripped out all the usual forumy bits).

Essentially we want the postbits (updates stream) block only to show if there are updates posted for that particular download.

Cheers,
Chris
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 12:03 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.04415 seconds
  • Memory Usage 2,274KB
  • Queries Executed 14 (?)
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
  • (4)bbcode_code
  • (3)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete