Yet Another Framework Yaf_View_Simple::assignRef
(Yaf >=1.0.0)
Yaf_View_Simple::assignRef — The assignRef purpose
설명
public Yaf_View_Simple::assignRef(string $name
, mixed &$value
): bool
Yaf_View_Simple::assign()과 달리 이 메서드는 엔진에 ref 값을 할당합니다.
매개변수
name
- 템플릿의 값에 액세스하는 데 사용할 문자열 이름입니다.
value
- mixed value
반환 값
Examples
예제 #1 Yaf_View_Simple::assignRef() 예제
<?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() 예제
<html>
<head>
<title><?php echo $foo; $foo = "changed"; ?></title>
</head>
<body>
</body>
</html>
위의 예는 다음과 유사한 결과를 출력합니다.
/* access the index controller will result: */ changed
기타
- Yaf_View_Simple::assign() - Assign values
- Yaf_View_Simple::__set() - Set value to engine