Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 17 Aug 2003, 22:42
Serge's Avatar
Serge Serge is offline
 
Join Date: Jan 2002
If statement

Ok I have the following IF statement:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now this is using vbulletin 3.0 but for some reason the eval is always ran and I always get the templeat even though I only want it in some forums. Is my IF statement incorrect?

Note: In vbulletin 3.0 f is used to determine the forum id.
Reply With Quote
  #2  
Old 17 Aug 2003, 23:05
SmEdD's Avatar
SmEdD SmEdD is offline
 
Join Date: Mar 2003
Location: Ontario, Canada
Real name: Stephen
vB3 code/hacking isn't allowed to be discussed yet.

Also editing any main files is pretty dumb. It's not even RC yet and that means alot may still change.
Reply With Quote
  #3  
Old 17 Aug 2003, 23:07
Serge's Avatar
Serge Serge is offline
 
Join Date: Jan 2002
Personally I feel this is perfectly legit. I have asked questions before about vbulletin 3. I'm not asking how to do it just if someone would look at my if statement and see if there is anything wrong with it.
Reply With Quote
  #4  
Old 17 Aug 2003, 23:15
SmEdD's Avatar
SmEdD SmEdD is offline
 
Join Date: Mar 2003
Location: Ontario, Canada
Real name: Stephen

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #5  
Old 17 Aug 2003, 23:24
Serge's Avatar
Serge Serge is offline
 
Join Date: Jan 2002
I think you still need the ' ' around the 57 but it works thanks!
Reply With Quote
  #6  
Old 17 Aug 2003, 23:38
filburt1 filburt1 is offline
 
Join Date: Feb 2002
PHP rarely cares about data types. The only time it definitely will is if you use the === operator which implicitly checks the type of the left and right values.

Also vB3 hacking discussion is not allowed as Steve said.
Reply With Quote
  #7  
Old 17 Aug 2003, 23:43
Serge's Avatar
Serge Serge is offline
 
Join Date: Jan 2002
Today at 12:38 AM filburt1 said this in Post #6
Also vB3 hacking discussion is not allowed as Steve said.

If my question was stated was it was is it ok? I didn't really want to know how to do it in vb3 just if my if statement was correct or not which Steve correct for me.
Reply With Quote
  #8  
Old 17 Aug 2003, 23:56
filburt1 filburt1 is offline
 
Join Date: Feb 2002
I'm just confirming what he said; I wasn't necessarily saying that your question was central to vB3.
Reply With Quote
  #9  
Old 18 Aug 2003, 01:01
SmEdD's Avatar
SmEdD SmEdD is offline
 
Join Date: Mar 2003
Location: Ontario, Canada
Real name: Stephen
Today at 07:24 PM Serge said this in Post #5
I think you still need the ' ' around the 57 but it works thanks!
Alot of time you actually don't need the ' ' around the == value
Reply With Quote
  #10  
Old 18 Aug 2003, 11:45
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Real name: Dean Clatworthy
You need the ' ' when it's a string
__________________
Dean Clatworthy - Web Developer/Designer
Reply With Quote
  #11  
Old 18 Aug 2003, 21:54
Gavin B. Gavin B. is offline
 
Join Date: Jul 2003
Today at 12:45 PM Mist said this in Post #10
You need the ' ' when it's a string

Yup - to keep with good coding practices Strings should be wrapped in either ' ... ' or " ..." and numbers can be left as is
__________________
Platinum-Central
Reply With Quote
  #12  
Old 19 Aug 2003, 00:01
SmEdD's Avatar
SmEdD SmEdD is offline
 
Join Date: Mar 2003
Location: Ontario, Canada
Real name: Stephen
Should be '...' for stings and "..." for html or holding a variable togeather if you want to goto good codeing practices.
Reply With Quote
  #13  
Old 19 Aug 2003, 00:28
Gavin B. Gavin B. is offline
 
Join Date: Jul 2003
' ... ' is a simple string which is not parsed by PHP for variables, etc.
" ... " is a complex string which is parsed (and is therefore slightly less efficient).

$mystring = '<a href="'.$link.'">Test URL</a>';
$mystring = "<a href=\"$link\">Test URL</a>";

both produce the same result, however the first example is more efficiant and (IMO) easier to read and work with.
__________________
Platinum-Central
Reply With Quote
  #14  
Old 19 Aug 2003, 12:51
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Real name: Dean Clatworthy
$mystring = '<a href="$link">test url</a>';

Should work?
__________________
Dean Clatworthy - Web Developer/Designer
Reply With Quote
  #15  
Old 19 Aug 2003, 13:01
Gavin B. Gavin B. is offline
 
Join Date: Jul 2003
in that case it will just print exactly that as php does not parse the string for variables
__________________
Platinum-Central
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 00:00.

Layout Options | Width: Wide Color: