View Full Version : If statement
Serge
08-17-2003, 09:42 PM
Ok I have the following IF statement:
if ($_GET['f'] = '57')
{
eval('$articlecat = "' . fetch_template('articlecat') . '";');
}
else
{
$articlecat = '';
}
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.
SmEdD
08-17-2003, 10:05 PM
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.
Serge
08-17-2003, 10:07 PM
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.
SmEdD
08-17-2003, 10:15 PM
if ($_GET['f'] == 57)
Serge
08-17-2003, 10:24 PM
I think you still need the ' ' around the 57 but it works thanks!
filburt1
08-17-2003, 10:38 PM
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.
Serge
08-17-2003, 10:43 PM
Today at 12:38 AM filburt1 said this in Post #6 (https://vborg.vbsupport.ru/showthread.php?postid=426698#post426698)
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.
filburt1
08-17-2003, 10:56 PM
I'm just confirming what he said; I wasn't necessarily saying that your question was central to vB3. :)
SmEdD
08-18-2003, 12:01 AM
Today at 07:24 PM Serge said this in Post #5 (https://vborg.vbsupport.ru/showthread.php?postid=426696#post426696)
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
Dean C
08-18-2003, 10:45 AM
You need the ' ' when it's a string :)
Gavin B.
08-18-2003, 08:54 PM
Today at 12:45 PM Mist said this in Post #10 (https://vborg.vbsupport.ru/showthread.php?postid=426799#post426799)
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 :)
SmEdD
08-18-2003, 11:01 PM
Should be '...' for stings and "..." for html or holding a variable togeather if you want to goto good codeing practices. ;)
Gavin B.
08-18-2003, 11:28 PM
' ... ' 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.
Dean C
08-19-2003, 11:51 AM
$mystring = '<a href="$link">test url</a>';
Should work?
Gavin B.
08-19-2003, 12:01 PM
in that case it will just print exactly that as php does not parse the string for variables :)
NTLDR
08-19-2003, 01:36 PM
Unless of course that string gets passed through eval(); later on ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.