Add the variables support to the renderer : we can send datas variable to the view and the view can manage them. The Search/Replacement feature continue to be available
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1531 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -16,10 +16,13 @@ class outputhtml extends output
|
|||||||
@param string|null $viewClass Class in views to use to display
|
@param string|null $viewClass Class in views to use to display
|
||||||
@param string|null $viewMethod Method in the class in views
|
@param string|null $viewMethod Method in the class in views
|
||||||
@param string|null $layout Layout file in views
|
@param string|null $layout Layout file in views
|
||||||
@param array|null $replacement Replace the {key}=>value */
|
@param array|null $replacement Replace the {key}=>value
|
||||||
|
@param array|null $variable PHP variables send to the view (can be
|
||||||
|
processed by foreach, if...) */
|
||||||
public function out ($data, $title = FALSE,
|
public function out ($data, $title = FALSE,
|
||||||
$viewClass = FALSE, $viewMethod = FALSE,
|
$viewClass = FALSE, $viewMethod = FALSE,
|
||||||
$layout = FALSE, $replacement = array())
|
$layout = FALSE, $replacement = array(),
|
||||||
|
$variable = array ())
|
||||||
{
|
{
|
||||||
@header("Cache-Control: no-store, no-cache, must-revalidate");
|
@header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||||
@header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
@header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
||||||
@@ -32,7 +35,7 @@ class outputhtml extends output
|
|||||||
{
|
{
|
||||||
require_once ("views/$viewClass.php");
|
require_once ("views/$viewClass.php");
|
||||||
$obj = new $viewClass;
|
$obj = new $viewClass;
|
||||||
$resView = $obj->$viewMethod ($data);
|
$resView = $obj->$viewMethod ($data, $variable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($layout !== FALSE)
|
if ($layout !== FALSE)
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ class renderer
|
|||||||
public $viewMethod = FALSE;
|
public $viewMethod = FALSE;
|
||||||
/** Filename in views containing the HTML layout. Without .html at the end */
|
/** Filename in views containing the HTML layout. Without .html at the end */
|
||||||
public $layout = FALSE;
|
public $layout = FALSE;
|
||||||
/** Array to replace */
|
/** Array to search/replace */
|
||||||
public $replacement = array();
|
public $replacement = array();
|
||||||
|
/** Array to variable definition */
|
||||||
|
public $variable = array ();
|
||||||
|
|
||||||
/** Display the $this->result result in the output model defined by
|
/** Display the $this->result result in the output model defined by
|
||||||
$this->output */
|
$this->output */
|
||||||
@@ -32,7 +34,7 @@ class renderer
|
|||||||
$res = $reflection->invokeArgs (new $class,
|
$res = $reflection->invokeArgs (new $class,
|
||||||
array ($this->result, $this->title,
|
array ($this->result, $this->title,
|
||||||
$this->viewClass, $this->viewMethod, $this->layout,
|
$this->viewClass, $this->viewMethod, $this->layout,
|
||||||
$this->replacement));
|
$this->replacement, $this->variable));
|
||||||
echo $res;
|
echo $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user