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)

Lynne 02-14-2009 03:53 AM

I'm not sure I understand. It sounds like you are simply using the postbit template, but not the showthread page, correct? So, do these posts even have post numbers? If so, then I suppose <if condition="$post[postcount] == '1'"> may be valid. I really can't tell because I'm not sure if you are using the same variable names at all for these posts.

connectr 02-14-2009 04:09 AM

Hi Lynne :)
Thanks for the reply and sorry for the confusion. I'll try explain in more detail.

As mentioned before, we're essentially styling the download manager plugin, vbdynamix. Each download has a details page, where you can post updates in the form of posts and optionally allow users to reply etc. This part of the page seems is handled by vb. Since we've told VBD to use its own template, we can go crazy on it without worrying about messing up the main forum.

My aim with this project is to get the downloads page to look un-forum-y as possible ;) This is what i have in the downloads details page (ADV_DYNA_SHOWENTRY):

PHP Code:

<if condition="$post[postcount] == '1'">
  <
div id="updates">
    <
h2>Update Stream:</h2>
    <
ul>$postbit</ul>
  </
div>
</if> 

I tried the conditional posts check you suggested, but unfortunately it didnt work.

In the postbit_legacy i have this:
PHP Code:

<li class="updates">
$template_hook[postbit_start]
$template_hook[postbit_messagearea_start]
<
class="update-date">$post[postdate]</p>
<
class="update-message">$post[message]</p>
<if 
condition="is_member_of($bbuserinfo, 6)"><a href="$post[editlink]name="vB::QuickEdit::$post[postid]">Edit</a></if>
$template_hook[postbit_end]
</
li

and the postbit_wrapper i have this (there was a bunch of other unnecessary html which i stripped out):
PHP Code:

$postbit 

Hope this helps..
Cheers,
Chris

Lynne 02-14-2009 04:19 AM

<if condition="$post[postcount] == '1'"> doesn't work? If not it's probably because $post[postcount] doesn't exist. You may have to spit out some variables in the templates in order to see exactly what is available and then determine what you want to use for your conditions.I am unfamiliar with vbdynamix so I really don't know that I can be of much help.

connectr 02-14-2009 04:38 AM

Hi Lynne,
I tried adding $post[postcount] into the ADV_DYNA_SHOWENTRY page and it didnt output anything. I then went on to add it to the postbit_legacy file and it now shows a 1,2,3 etc on each of the posts. So i'm guessing hte postcount option only works when inside of the postbit template.

You mentioned spitting out some variables to see what is available. Could you elaborate?

Thanks,
Chris

Lynne 02-14-2009 04:52 AM

It sounds like you did what I was suggesting - putting something like $post[postcount] in the template to see what gets spit out. Unfortunately, I don't understand what this output page is you are talking about. If that variable works in the template, isn't that where you wanted to use it? You could do what you were saying in the postbit_legacty template by just wrapping it all in a condition, no?

HTML Code:

<if condition="$post[postcount] == '1'">
<li class="updates">
$template_hook[postbit_start]
$template_hook[postbit_messagearea_start]
<p class="update-date">$post[postdate]</p>
<p class="update-message">$post[message]</p>
<if condition="is_member_of($bbuserinfo, 6)"><a href="$post[editlink]" name="vB::QuickEdit::$post[postid]">Edit</a></if>
$template_hook[postbit_end]
</li>
<else />
something else
</if>


connectr 02-14-2009 05:30 AM

Your comment just sparked an idea! The postcount works when its inside of the postbit template, so if i move the stuff from the ADV_DYNA_SHOWENTRY template into the postbit_wrapper, the postcount should work and we would be golden. I'm gona give it a shot now and will post my findings once i've tested it..
Thanks again!
Chris

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

close but no cigar :( it seems that postbit_wrapper is part of the postbit loop. The download that has no updates doesnt display the updates block, which is what we want, but then the download that has 5 updates displays the updates block, but only outputs one post.

Any ideas?

connectr 02-14-2009 05:51 AM

1 Attachment(s)
My goal has been to completely hide the updates block if no updates are available, but thinking more for consistency sake having the block always there isnt necessarily a bad thing. So now i am trying your suggestion, adding the check to the postbit_legacy template:

<if condition="$post[postcount] == '1'">
<li class="updates">
$template_hook[postbit_start]
$template_hook[postbit_messagearea_start]
<p class="update-date">$post[postdate]</p>
<p class="update-message">$post[message]</p>
<if condition="is_member_of($bbuserinfo, 6)"><a href="$post[editlink]" name="vB::QuickEdit::$post[postid]">Edit</a></if>
$template_hook[postbit_end]
</li>
<else />
<li class="no-updates">
$template_hook[postbit_start]
$template_hook[postbit_messagearea_start]
There are no updates for this template.
$template_hook[postbit_end]
</li>
</if>

Based on the above, you would expect that the updates block will always be there and if update posts exist, they are displayed, else show a message saying that no updates are available.

Unfortunately, what i've ended up with is just the updates heading on the page that doest have any updates (ie, no message saying no updates below the heading) and then on the page that does have updates i have the first update message displaying, but then the no updates messages outputted 3 times where the other updates should be.

I know that probably doesnt make sense, so i've attached two images - one showing the download that doesnt have any posts and one of the download that does have posts.

Thanks,
Chris

connectr 02-14-2009 05:54 AM

Looking at the code again, and studying the output of the postcount variable, i think i know why its outputting the way it is. It looks like the conditional is saying "if postcount is equal to 1", essentially targeting only the post whose post count is 1, ie the first post.

What do you think? Is it possible to tweak the conditional to say if posts exist, else...

Dismounted 02-14-2009 10:16 AM

I'm a bit confused, but can't you just use the adlocation_firstpost template?

connectr 02-14-2009 12:20 PM

Hi Dismounted,
You'll have to excuse as this is my first vb project and am not yet 100% on par with how everything works. Would you mind elaborating on how you see it working? I recall seeing the adlocation_firspost variable in the postbit, but figured it was just a placeholder for a banner ad after the first post..
Cheers,
Chris


All times are GMT. The time now is 09:33 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.01858 seconds
  • Memory Usage 1,756KB
  • 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
  • (1)bbcode_html_printable
  • (3)bbcode_php_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