Hello,
Im building a site in mvc. Now i have written this controller class. But i cant capture the get variable inside the class using another variable $action1. But if I use switch($_GET[‘cat’]){} it works. Why isn’t it working this way???
this is the error im getting;
Parse error: syntax error, unexpected T_VARIABLE
And this is the code.
class BaseController{
static $action1 = $_GET[‘cat’];
public static function get_cat(){
switch($action1){
case “gui”:
$rec=Category::display_sub_cat(1);
include(VIEW_PATH.‘category.php’);
return $rec;
case “wwind”:
$rec=Category::display_sub_cat(2);
include(VIEW_PATH.‘category.php’);
return $rec;
}}}
Also after using switch($_GET[‘cat’]){} the page ‘category.php’ is not getting included. No errors but the file is not getting included… Please someone help me to solve this.