The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
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. |
#2
|
|||
|
|||
Code:
<if condition="$post['field#']">$post[field#]</if> |
#3
|
|||
|
|||
Hi
You need to add something like this Code:
<if condition="$post['fieldX']"> Don't forget to end it too Code:
</if> SNAP |
#4
|
||||
|
||||
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> HTML Code:
<if condition="$post['fieldx']"><div>Whatever: $post[fieldx]</div></if> |
#5
|
||||
|
||||
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. |
#6
|
||||
|
||||
So you actually need something to show up under the first post in a thread?
|
#7
|
||||
|
||||
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.
|
#8
|
||||
|
||||
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> |
#9
|
||||
|
||||
As always, thank you for your suggestions Lynne, and everybody else for that matter.
|
#10
|
|||
|
|||
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 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|