Yaf_View_Simple
Yaf_View_Simple::assignRef
Yaf_View_Simple
PHP Manual

# Yaf_View_Simple::assign

(PECL yaf >=1.0.0)

Yaf_View_Simple::assign — Assign values

### Opis

public bool Yaf_View_Simple::assign ( string `$name` [, mixed `$value` ] )

assign variable to view engine

### Parametry

`name`

  A string or an array.

  if is string, then the next argument $value is required.

`value`

  mixed value

### Zwracane wartości

### Przykłady

Przykład #1 Yaf_View_Simple::assign()example

`<?php
class IndexController extends Yaf_Controller_Abstract {
public function indexAction() {
$this->getView()->assign("foo", "bar");
$this->_view->assign( array( "key" => "value", "name" => "value"));
}
?>`

Przykład #2 template()example

`<html>
<head>
<title><?php echo $foo; ?></title>
</head>
<body>
<?php
foreach ($this->_tpl_vars as $name => value) {
echo $$name; // or echo $this->_tpl_vars[$name];
}
?>
</body>
</html>`

### Zobacz też:

- Yaf_View_Simple::assignRef() - The assignRef purpose
- Yaf_View_Interface::clear()
- Yaf_View_Simple::__set() - Set value to engine

Yaf_View_Simple
Yaf_View_Simple::assignRef
Yaf_View_Simple
PHP Manual