vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Can you do if conditions based on the =action and not just THIS_SCRIPT? (https://vborg.vbsupport.ru/showthread.php?t=322409)

greigeh 04-18-2016 07:01 PM

Can you do if conditions based on the =action and not just THIS_SCRIPT?
 
title says it all, i'm sure you can but not sure on the condition

Dr.CustUmz 04-18-2016 08:42 PM

PHP Code:

if ($_REQUEST['do'] == 'action') {
  Do 
this
} else {
  Do 
that


is this what you mean?

greigeh 04-19-2016 03:11 PM

Quote:

Originally Posted by Dr.CustUmz (Post 2569227)
PHP Code:

if ($_REQUEST['do'] == 'action') {
  Do 
this
} else {
  Do 
that


is this what you mean?

This is technically what i mean, but is that string not available as a pre-made if condition? cause to me that looks like to be used in a script or something.

squidsk 04-19-2016 03:52 PM

If you're trying to do something in a template then just put the condition part of the if statement in the quotes of the condition attribute of the if tag otherwise.

Code:

<if condition="$_REQUEST['do'] == 'action'">
<else />
<endif>

Of course your template would be far neater if you set a the value you wanted output in the script (based on the condition) and then just had the template output the final value.

Dr.CustUmz 04-19-2016 06:10 PM

Quote:

Originally Posted by greigeh (Post 2569254)
This is technically what i mean, but is that string not available as a pre-made if condition? cause to me that looks like to be used in a script or something.

just for learning =) what i posted is a real if condition, what vbulletin uses is it's own variation of php / html so

in php
Code:

if ($_REQUEST['do'] == 'action') {
  Do this
} else {
  Do that
}

or even better:
Code:

($_REQUEST['do'] == 'action') ? (Do this) : (Do that)
is the same as
vBulletin php/html
Code:

<if condition="$_REQUEST['do'] == 'action'">
  do this
<else />
  do that
</if>

all 3 blocks of code are the same and its good to know these ways for plugins / templates


All times are GMT. The time now is 04:04 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.01060 seconds
  • Memory Usage 1,724KB
  • 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
  • (2)bbcode_php_printable
  • (2)bbcode_quote_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