vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   if and else conditional help (https://vborg.vbsupport.ru/showthread.php?t=139726)

mac27 02-18-2007 04:42 AM

if and else conditional help
 
I have 2 scripts in one template that I want to use. One shows buttons and one shows text links. I am trying to make it so the user can choose which one they want to use in their forum. So I am trying to make it so that they can turn off the buttons and the text links will turn on. So I thought the <if> and <else /> conditional would work. Well it doesn't unless I did it wrong.

So what is the proper way to get this to work? Is there an easier way?

Thanks and I hope I explained this good enough.

harmor19 02-18-2007 05:54 AM

You can do it this way.
Add a new profile field (Single-Selection Radio Buttons)
---------------------------------------------
Title: Buttons/Text
Description: Select Yes to use buttons. Choose No to use text.

Options:
Yes
No
---------------------------------------------

You can leave everything else the same.

In the template of the custom page add

PHP Code:

<if condition="$bbuserinfo[fieldXX] == 'Yes'">
Button goes here
<else />
text goes here
</if> 

Replace XX with the field number

mac27 02-18-2007 05:59 AM

Thanks and I had thought about that. But I would rather have it so the admin can control what is used on their forum not the user.

I added a vboption with the yes and no radio buttons and tried it that way to but no luck. Some reason it won't work.

Thanks for the info. I am open to more ideas.

harmor19 02-18-2007 06:06 AM

If you have enabled Debug Mode you should be able to add settings when you go to vBulletion Options. The best place to add your new option would be "General Settings".
So go to vBulletin Option --> General Settings

Varname: switch_buttons_text
Title: Switch Buttons/Text
Description: Select Yes to use buttons. Choose No to use text.
Option Code: yesno
Data Validation Type: Boolean

In your template add
PHP Code:

<if condition="$vboptions[switch_buttons_text]">
Button goes here
<else />
text goes here
</if> 


mac27 02-18-2007 06:07 AM

OK I got it. Your post got me back in line again. Guess I am to tired to be working tonight. LOL

PHP Code:

<if condition="$vboptions[varname] == '1'">
Button goes here
<else />
text goes here
</if> 

That is what I had to use.


All times are GMT. The time now is 04:06 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.02286 seconds
  • Memory Usage 1,719KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete