Yaf_View_Simple::assign
Yaf_View_Simple::clear
Yaf_View_Simple
PHP Manual

# Yaf_View_Simple::assignRef

(PECL yaf >=1.0.0)

Yaf_View_Simple::assignRef — The assignRef purpose

### Opis

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

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

### Parametry

`name`

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

`value`

  mixed value

### Zwracane wartości

### Przykłady

Przykład #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);
}
?>`

Przykład #2 template()example

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

Powyższy przykład wyświetli coś podobnego do:

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

### Zobacz też:

- Yaf_View_Simple::assign() - Assign values
- Yaf_View_Simple::__set() - Set value to engine

Yaf_View_Simple::assign
Yaf_View_Simple::clear
Yaf_View_Simple
PHP Manual