Yaf_View_Simple::assignRef

(Yaf >=1.0.0)

Yaf_View_Simple::assignRefThe assignRef purpose

Опис

public Yaf_View_Simple::assignRef(string $name, mixed &$value): bool

unlike Yaf_View_Simple::assign(), this method assign a ref value to engine.

Параметри

name

A string name which will be used to access the value in the tempalte.

value

mixed value

Значення, що повертаються

Приклади

Приклад #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);
}
}
?>

Приклад #2 template()example

<html>
<head>
<title><?php echo $foo; $foo = "changed"; ?></title>
</head>
<body>
</body>
</html>

Поданий вище приклад виведе щось схоже на:

/* access the index controller will result: */
changed

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top