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 09-11-2011, 08:38 PM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default PHP - A condition into a condition

Hi everywone is me again, I have this condition
PHP Code:
if (condition1 OR condition2)
{
Do 
some php code

I want to add "or condition2" just if(condition3)
This is the best that i can do for let you understand
Here the code that i've supposed and tried (give me this error: unexpected T_CONSTANT_ENCAPSED_STRING)
PHP Code:
if (condition1 '. if (condition3){ OR condition2}.')
{
Do 
some php code

hope that you understand what i mean
Reply With Quote
  #2  
Old 09-11-2011, 09:41 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Assuming I understood you ;

PHP Code:
if (condition1 OR (condition2 AND condition3)) 
Reply With Quote
Благодарность от:
Scanu
  #3  
Old 09-12-2011, 09:11 AM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry i will eplain better with some php code supposed
PHP Code:
//Settings
$test true
//true The text will be show if condition 1 or if condition2
//false The text will be show if condition 1


if (condition1 if ($test == "true"){ OR condition2})
{
php

Reply With Quote
  #4  
Old 09-12-2011, 10:05 AM
Mooff Mooff is offline
 
Join Date: Mar 2010
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is what Pauls code will do?
Reply With Quote
  #5  
Old 09-12-2011, 10:19 AM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't think
Reply With Quote
  #6  
Old 09-12-2011, 10:25 AM
Mooff Mooff is offline
 
Join Date: Mar 2010
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
if (condition1 OR (condition2 AND condition3))  
{
....
}
condition3 = true
=>
if (condition1 OR condition2)

condition3 = false
=>
if (condition1)


exactly as you wanted here:
Quote:
//true The text will be show if condition 1 or if condition2
//false The text will be show if condition 1
Reply With Quote
Благодарность от:
Scanu
  #7  
Old 09-12-2011, 10:32 AM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OH! Sorry!
If this code mean
Quote:
condition3 = true
=>
if (condition1 OR condition2)

condition3 = false
=>
if (condition1)
Is perfect thanks paul and thanks Mooff i will try it

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

so this code would be right?
PHP Code:
if ($vbulletin->userinfo['field'.$field1.''] OR ($vbulletin->userinfo['field'.$field2.''] AND $field2) OR ($vbulletin->userinfo['field'.$field3.''] AND $field3) OR ($vbulletin->userinfo['field'.$field4.''] AND $field4))
{
}
$field1 $vbulletin->options['var_field1'];
$field2 $vbulletin->options['var_field2'];
$field3 $vbulletin->options['var_field3'];
$field4 $vbulletin->options['var_field4']; 
Is very hard to understand if you aren't in my mind

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

I've tried this code
PHP Code:
if ($vbulletin->userinfo['field'.$field1.''] OR ($vbulletin->userinfo['field'.$field2.''] AND $field2) OR ($vbulletin->userinfo['field'.$field3.''] AND $field3) OR ($vbulletin->userinfo['field'.$field4.''] AND $field4))
{}
else{

$template_hook['header_userinfo'] .= 'test';}

$field1 $vbulletin->options['var_field1'];
$field2 $vbulletin->options['var_field2'];
$field3 $vbulletin->options['var_field3'];
$field4 $vbulletin->options['var_field4']; 
but it seems don't work bu the options i have put
1 as var_field1
2 as var_field2
3 as var_field3
4 as var_field4
All fields that i've fill but still seeing "test"
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 08:24 PM.


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.04115 seconds
  • Memory Usage 2,244KB
  • 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
  • (1)bbcode_code
  • (6)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (2)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete