Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: Rayne - maaliskuu 08, 2006, 12:17:34 IP

Otsikko: custom 'action' with switch case?
Kirjoitti: Rayne - maaliskuu 08, 2006, 12:17:34 IP
(sorry if im posting this in the wrong section) ok i know how to do the custom actions, but what i am wonding is if there is a way to use switch case in side of it i have tired i have tired the following codes to test but only the else{} is working..

if statement style

<?php
if ($var == 1) {
    
printf('one');
} elseif (
$var == 2) {
    
printf('two');;
}
else
{
printf('nothing');
}
?>




<?php
if (isset($HTTP_GET_VARS['action'])) { 
               
$action $HTTP_GET_VARS['action']; 
               switch(
$action) { 
                    case 
"1"
                         
printf('one'); 
                         break;
case "2"
                         
printf('two'); 
                         break;
}
 
}
else
{
printf('nothing');
}
 
?>



any ideas on this?
Otsikko: Re: custom 'action' with switch case?
Kirjoitti: Thantos - maaliskuu 08, 2006, 03:53:58 IP
http://www.simplemachines.org/community/index.php?topic=75193.0