Yet Another Framework Yaf_View_Simple::assign
(Yaf >=1.0.0)
Yaf_View_Simple::assign — Assign values
설명
public Yaf_View_Simple::assign(string $name
, mixed $value
= ?): bool
view 엔진에 변수 할당
매개변수
name
- 문자열 또는 배열입니다.
문자열이면 다음 인수 $value가 필요합니다.
value
- mixed value
반환 값
Examples
예제 #1 Yaf_View_Simple::assign() 예제
<?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() 예제
<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>
기타
- Yaf_View_Simple::assignRef() - The assignRef purpose
- Yaf_View_Interface::clear()
- Yaf_View_Simple::__set() - Set value to engine