Yaf_View_Simple::assignRef
(Yaf >=1.0.0)
Yaf_View_Simple::assignRef — The assignRef purpose
Description
unlike Yaf_View_Simple::assign(), this method assign a ref value to engine.
Parameters
-
name
-
A string name which will be used to access the value in the tempalte.
-
value
-
mixed value
Return Values
Examples
Example #1 Yaf_View_Simple::assignRef()example
<?php
class IndexController extends Yaf_Controller_Abstract {
public function indexAction() {
$value = "bar";
$this->getView()->assign("foo", $value);
/* plz note that there was a bug before Yaf 2.1.4,
* which make following output "bar";
*/
$dummy = $this->getView()->render("index/index.phtml");
echo $value;
//prevent the auto-render
Yaf_Dispatcher::getInstance()->autoRender(FALSE);
}
?>
Example #2 template()example
<html>
<head>
<title><?php echo $foo; $foo = "changed"; ?></title>
</head>
<body>
</body>
</html>
The above example will output something similar to:
/* access the index controller will result: */ changed
See Also
- Yaf_View_Simple::assign() - Assign values
- Yaf_View_Simple::__set() - Set value to engine
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Другие базовые расширения
- Yet Another Framework
- Функция Yaf_View_Simple::assign() - Assign values
- Функция Yaf_View_Simple::assignRef() - The assignRef purpose
- Функция Yaf_View_Simple::clear() - Clear Assigned values
- Функция Yaf_View_Simple::__construct() - Constructor of Yaf_View_Simple
- Функция Yaf_View_Simple::display() - Render and display
- Функция Yaf_View_Simple::eval() - Render template
- Функция Yaf_View_Simple::__get() - Retrieve assigned variable
- Функция Yaf_View_Simple::getScriptPath() - Get templates directory
- Функция Yaf_View_Simple::__isset() - The __isset purpose
- Функция Yaf_View_Simple::render() - Render template
- Функция Yaf_View_Simple::__set() - Set value to engine
- Функция Yaf_View_Simple::setScriptPath() - Set tempaltes directory
Коментарии
404 Not Found