vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   vB4 Template Conditionals List (https://vborg.vbsupport.ru/showthread.php?t=231525)

ozzy47 12-21-2014 10:08 PM

Try $GLOBALS['forumid'] instead of $forum[forumid].

tommyxv 12-21-2014 10:13 PM

You da man ozzy! Worked perfectly! Thanks!

ozzy47 12-21-2014 10:15 PM

Excellent, glad to hear. :)

HM666 02-20-2015 03:39 PM

I have a conditionals question. I need to use two else statements within one area like this:

Code:

<vb:if condition="$GLOBALS['forumid'] == 2"><h1>This is my header</h1></vb:else>
<vb:if condition="$GLOBALS['forumid'] == 3"><h1>This is my other possible header</h1></vb:else><h1>{vb:rawphrase post_new_thread}</h1></vb:if>

Obviously its wrong, but how do I only have a particular title in only one forum and another different title in just one other forum and then have the standard vb headers for all the rest using conditionals? Or am I'm doomed to have to figure out a plugin for this little feat? Any help would be great, thanks.

kh99 02-20-2015 06:38 PM

I think this should work:

Code:

<vb:if condition="$GLOBALS['forumid'] == 2"><h1>This is my header</h1>
<vb:elseif condition="$GLOBALS['forumid'] == 3" /><h1>This is my other possible header</h1><vb:else /><h1>{vb:rawphrase post_new_thread}</h1></vb:if>

For future reference, here's the manual page: http://www.vbulletin.com/docs/html/m...e_conditionals

HM666 02-20-2015 09:10 PM

Thanks Kevin that worked! :)

inigo 03-11-2015 06:22 AM

Thanks for the help you provide in this post. I am looking for one conditional I haven't found in this topic.

The idea is to have a conditional in the blogs, showing a content only if it is one blog.

<vb if condition="blog user id = 3954">show this<vb if/>

But i don't know the variable to use in: "blog user id = 3954"

I want to put this in the sidebar to show special logo for the blog of each user.

Any help would be great!!!

Thanks,

HM666 03-29-2015 08:52 AM

I'm re-coding my forum leaders page and I need a conditional to call the avatar & username of a staff member. How do I go about doing this exactly? I'm creating 3 columns and putting a user in each column coding it myself in the template but I want the ability for the avatars & usernames to change automatically if the staff member changes it in their profile. This is a custom coded page so I'm not planning on using the default vB 4 group id codes that are found in the showgroups template.

Mecho 04-28-2015 12:23 PM

we have a section with 3 different Prefix - so they have a SAME forum ID but different prefix.

is it possible to have one message to ALL posts in that forum but only with one specific of those 3 prefixes ???

Thanks

m2006 09-23-2015 06:45 AM

hi i need show only by ['threadid']

Skyrider 10-04-2015 10:37 AM

Anyone happen to know the condition (for mod/supers) that IF can view user profile?

Alan_SP 10-04-2015 12:36 PM

Do you mean this:

HTML Code:

<vb:if condition="can_moderate()">Show this to all moderators</vb:if>

itilm 03-06-2016 12:02 AM

hello sir i need to hide Adsense from 5 or 7 forums can you give me the code of hiding from several forums

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

Quote:

<vb:if condition="$GLOBALS['forumid'] != x">Show this if forum id is not x</vb:if>
Please modify this code for me to multiple forums

Alan_SP 03-06-2016 02:28 PM

For multiple forums use this:

HTML Code:

<if condition="!in_array($GLOBALS[forumid], array(1,2,3,4,5...))>
Numbers are forum ids. You can use as many as you want.

HM666 06-28-2016 08:39 PM

Quote:

Originally Posted by Alan_SP (Post 2566632)
For multiple forums use this:

HTML Code:

<if condition="!in_array($GLOBALS[forumid], array(1,2,3,4,5...))>
Numbers are forum ids. You can use as many as you want.

Sorry but this does not work. I get a PHP error & an error message when trying to change this. I want to have something NOT show in more than one forum at a time. Here is what I have from the post above but it does not work. Anyone know what I can use instead?

Code:

<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3...))>
Thanks

Dragonsys 06-29-2016 02:03 PM

Quote:

Originally Posted by HM666 (Post 2572600)
Sorry but this does not work. I get a PHP error & an error message when trying to change this. I want to have something NOT show in more than one forum at a time. Here is what I have from the post above but it does not work. Anyone know what I can use instead?

Code:

<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3...))>
Thanks

remove the ...
Code:

<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3))>

HM666 06-29-2016 04:21 PM

Quote:

Originally Posted by Dragonsys (Post 2572620)
remove the ...
Code:

<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3))>

Yes I know it still does not work. I put that to simulate that there would be more forum ID's. I did not want to put my actual forum ID's in the post. The code as it stands does not work.

MarkFL 06-29-2016 04:32 PM

You need to close the condition with a double quote:

HTML Code:

<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3))">

HM666 06-29-2016 05:42 PM

Quote:

Originally Posted by MarkFL (Post 2572626)
You need to close the condition with a double quote:

HTML Code:

<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3))">

Ah yeah, I should not attempt these things when I'm not awake LOL. I'll give that a try I'm sure that was the problem.

Edit: That worked, thanks Mark!

Stratis 02-05-2017 04:05 PM

I want to show image with link only in specific language and not to show in specific script.

This is my code: (works only with language) I see image in register.php

Code:

<vb:if condition="$bbuserinfo[languageid] == 2">
<vb:if condition="THIS_SCRIPT != 'register'">

<a href="register.php"><img src="images/register.png" alt="REGISTER" height="60" width="315" /></a>

</vb:if>
</vb:if>

Any help please :)

MarkFL 02-05-2017 04:28 PM

Put your code into place on your test site, and I'll take a look. It looks to me like it should work, although I would combine the two conditions personally. :)

Stratis 02-05-2017 04:44 PM

Quote:

Originally Posted by MarkFL (Post 2581877)
Put your code into place on your test site, and I'll take a look. It looks to me like it should work, although I would combine the two conditions personally. :)

Ok, ready... thanks

MarkFL 02-05-2017 05:08 PM

Quote:

Originally Posted by Stratis (Post 2581878)
Ok, ready... thanks

I get a blank white page when I click the "Register" button...:)

Stratis 02-05-2017 05:13 PM

Quote:

Originally Posted by MarkFL (Post 2581882)
I get a blank white page when I click the "Register" button...:)

Yep, this only happens in my test forum, never made registration to check it.
Thanks Mark. if you see that code is ok, than i will test again to see whats up

MarkFL 02-05-2017 05:21 PM

I would combine the conditions as follows:

HTML Code:

<vb:if condition="$show['guest'] AND $bbuserinfo[languageid] == 1 AND THIS_SCRIPT != 'register'">
<a href="register.php"><img src="images/register_now_en.png" alt="REGISTER" height="60" width="315" /></a>
</vb:if>


Stratis 02-05-2017 05:36 PM

Thank you Mark it works, I do not know why the above does not, Any way the results matter. :)

MarkFL 02-05-2017 05:43 PM

Quote:

Originally Posted by Stratis (Post 2581889)
Thank you Mark it works, I do not know why the above does not, Any way the results matter. :)

Yeah, I can't explain why what you wrote didn't work...but glad you now have the result you were after. :D

Stratis 02-05-2017 05:53 PM

Yes :)


For my knowledge and may be in use, how to put more than one Script I need


Lets say 'register' and "login"


Thanks




MarkFL 02-05-2017 05:57 PM

Try:

PHP Code:

!in_array(THIS_SCRIPT, array('register''login')) 

within your template conditional, replacing:

PHP Code:

THIS_SCRIPT != 'register' 


Alan_SP 07-09-2017 06:25 PM

I have a problem with this

HTML Code:

THIS_SCRIPT != 'tags'
In default mobile style, which Google needs to have site mobile compatible, it causes problems. I need to disable showing ads in tags, it works in default style, but doesn't work in default mobile style and it also generates http 500 error, not showing thread pages and there's other problems with showing pages when I use tags within template.

Anyway, is there a way to block showing ads for tags within default mobile style? Which template is used in default mobile style to show /tags/some_tag/ link, which shows all threads with that tag?

rbc 10-11-2017 05:59 PM

What do i wrong here ? :eek:

HTML Code:

<vb:if condition="is_member_of($bbuserinfo, 1) AND THIS_SCRIPT == 'commerce_cart'">
<div align="right" style="position:relative; top:-25px !important; bottom:-15px; float: right;
    clear: left;"
>

<vb:else />
BlaBla
</vb:if >

thanx :)

MarkFL 10-11-2017 06:23 PM

I would use the condition:

HTML Code:

$show['guest']
to check if a user isn't a logged in registered member. It doesn't require an additional query. ;)

rbc 10-12-2017 08:51 AM

Oh yes, thanks for your hint Mark :up:

wraggster 02-22-2020 05:48 PM

I need to have a conditional that shows only on the vbcms index page only, can this be done ?

Bulent Tekcan 04-05-2020 03:26 PM

Hello,

Is it possible to remove adsense code spesific thread ?

Regards

Bulent Tekcan 04-27-2020 03:51 PM

Quote:

Originally Posted by Bulent Tekcan (Post 2602484)
Hello,


Is it possible to remove adsense code spesific thread ?


Regards




Nobody ???

abcde 08-09-2020 08:32 PM

Code:


<vb:if condition="$forum[forumid] == x">Show this if forum id is x</vb:if>

I tried this but doesnt seems to work anymore.

z3r0 08-10-2020 06:31 AM

Quote:

Originally Posted by abcde (Post 2603709)
Code:


<vb:if condition="$forum[forumid] == x">Show this if forum id is x</vb:if>

I tried this but doesnt seems to work anymore.

Try this instead.

Code:

<vb:if condition="$GLOBALS['forumid'] == x">Show this if forum id is x</vb:if>

abcde 08-27-2020 01:51 PM

Quote:

Originally Posted by z3r0 (Post 2603710)
Try this instead.

Code:

<vb:if condition="$GLOBALS['forumid'] == x">Show this if forum id is x</vb:if>

thanks

Scalemotorcars 10-13-2020 08:14 PM

And thanks from me as well. This worked perfectly...


All times are GMT. The time now is 12:53 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.01893 seconds
  • Memory Usage 1,838KB
  • 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
  • (11)bbcode_code_printable
  • (9)bbcode_html_printable
  • (2)bbcode_php_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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