vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   how to do a conditional element on the postbit (https://vborg.vbsupport.ru/showthread.php?t=205255)

columbusgeek 02-13-2009 01:34 PM

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.

Spank 02-13-2009 02:09 PM

Code:

<if condition="$post['field#']">$post[field#]</if>
Be sure to replace the # with the field number.

UKBusinessLive 02-13-2009 02:09 PM

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 (Post 1742905)
Code:

<if condition="$post['field#']">$post[field#]</if>
Be sure to replace the # with the field number.

SNAP :D:D

Lynne 02-13-2009 02:21 PM

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.

columbusgeek 02-13-2009 02:52 PM

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.

Lynne 02-13-2009 03:04 PM

So you actually need something to show up under the first post in a thread?

columbusgeek 02-13-2009 03:13 PM

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.

Lynne 02-13-2009 04:23 PM

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>


columbusgeek 02-13-2009 05:44 PM

As always, thank you for your suggestions Lynne, and everybody else for that matter.

connectr 02-14-2009 03:39 AM

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


All times are GMT. The time now is 01:02 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.01103 seconds
  • Memory Usage 1,740KB
  • 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
  • (4)bbcode_code_printable
  • (3)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete