Yaf_View_Simple::assign

(Yaf >=1.0.0)

Yaf_View_Simple::assignAssign values

Опис

public Yaf_View_Simple::assign(string $name, mixed $value = ?): bool

assign variable to view engine

Параметри

name

A string or an array.

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

value

mixed value

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

Приклади

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

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

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

add a note

User Contributed Notes

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