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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-04-2010, 12:30 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Why aren't these conditionals working?

They work fine in 3.8.x, I added the "vb:" to them for 4.0.x but they don't work anymore... In fact they don't resolve to numbers at all, when I write "$thread[forumid]" in the template it just displays on the page "$thread[forumid]" instead of something like "2".

<vb:if condition="($foruminfo[forumid] == 2) AND ($thread[forumid] != 2)">[X]</vb:if>

This is in the threadbit template... are these variables no longer available in threadbit?

Edit- OK I see there is a new syntax for accessing these things in vb4 and boy does that suck big time... anyway Itried a couple things but no go, anything know how to translate the above to vb4? {vb:var thread.forumid} and such isn't working either.

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

Using this code:
Code:
<if condition="({vb:var foruminfo.forumid} == 1) AND ({vb:var thread.forumid} != 1)">
[X]</vb:if>
I get a warning about adding a child to a non-existent node when I try to save the template.
Reply With Quote
  #2  
Old 07-04-2010, 01:50 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<vb:if condition="$foruminfo[forumid] == 2 AND $thread[forumid] != 2">[X]</vb:if>

The raw variables do not work in conditions.
Reply With Quote
  #3  
Old 07-04-2010, 02:32 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

but shouldn't these work?
<if condition="({vb:var foruminfo.forumid} == 1) AND ({vb:var thread.forumid} != 1)">
[X]</vb:if>
Reply With Quote
  #4  
Old 07-04-2010, 02:49 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, you can not use raw variables like that in conditional statements.
Reply With Quote
  #5  
Old 07-04-2010, 02:52 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK... how would I go about getting the value of those to use in a conditional?
Reply With Quote
  #6  
Old 07-04-2010, 03:43 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<vb:if condition="$foruminfo['forumid'] == '1' AND $thread['forumid'] != '1'">
[X]
</vb:if>
Reply With Quote
  #7  
Old 07-04-2010, 04:00 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
<vb:if condition="$foruminfo['forumid'] == '1' AND $thread['forumid'] != '1'">
[X]
</vb:if>
That's what I thought in my first post (I added the single quotes around 'foumid' just in case...) but neither of those resolve in the threadbit template... am I missing something?
Reply With Quote
  #8  
Old 07-04-2010, 04:42 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is it you are trying to do exactly? That might help in figuring this out. You said it worked in 3.8. Is it a hack you are trying to update or what?
Reply With Quote
  #9  
Old 07-04-2010, 05:08 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, this is an 'additional option' for my "All Topic" mod which I already released for vb4, it was all php code changes so it was no big deal.

This was just supposed to be a way to modify a thread title to show if a thread being listed originates in another forum, as that is what my 'all topic' mod does- displays threads from multiple forums in a single forum.

The entire code for this in 3.8 was:
Code:
<if condition="$vbulletin->userinfo['field5'] != 'No'">
<if condition="($foruminfo[forumid] == 1) AND ($thread[forumid] != 1)">[X]</if></if>
Which basically means:
If the all-topic system is enabled (field5)
then... if the forum your viewing is the master forum (1) AND the thread's forum or origin IS NOT (1) then put "[X]" in the thread title.
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 09:17 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04009 seconds
  • Memory Usage 2,240KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_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