Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed views setting and getting this->
- Loading branch information
Showing
4 changed files
with
44 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<? | ||
class HandlerBase { | ||
|
||
protected $context = null; | ||
protected static $vars = array(); | ||
|
||
function __construct($context) { | ||
$this->context = $context; | ||
} | ||
|
||
function __call($method_name, $parameters) { | ||
if(method_exists($this, $method_name)) { | ||
# If the method exists, just call it | ||
$result = call_user_func_array(array($this, $method_name), $parameters); | ||
} elseif(method_exists(Trax::$current_controller_object, $method_name)) { | ||
$result = call_user_func_array(array(Trax::$current_controller_object, $method_name), $parameters); | ||
} | ||
return $result; | ||
} | ||
|
||
function __get($key) { | ||
if(in_array($key, self::$vars)) { | ||
return self::$vars[$key]; | ||
} elseif(property_exists($this, $key)) { | ||
return $this->$key; | ||
} elseif(property_exists(Trax::$current_controller_object, $key)) { | ||
return Trax::$current_controller_object->{$key}; | ||
} | ||
} | ||
|
||
function __set($key, $value) { | ||
self::$vars[$key] = $value; | ||
$this->{$key} = $value; | ||
} | ||
|
||
function render($path, $locals = array()) { | ||
echo "Please implement me in child class!"; | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters