Zend Framework :: How should title html element get from view?(set view->headTitle()).
Example of view title output source: (I need to get: some browser title)
<title> some browser title </title>
My Code that print huge array:
$this->view->headTitle('some browser title');//set working
echo var_export($this->headTitle()); //get not working
please help to get title element of the view.
Thanks
In view
$this->headTitle('some browser title');
echo $this->headTitle(); //<title>some browser title<title>
echo strip_tags($this->headTitle()); //some browser title
Think it should be:
$this->view->headTitle('some browser title')
;
to set the page title.
Change your set to:
$this->view->headTitle('some browser title');
and your get to:
echo var_export($this->headTitle);
(notice the removal of the "()" after headTitle).
到目前为止,最简单的解决方案来获取视图助手的返回值:
$titleTag = (string)$this->headTitle(); //with title tag, use strip tags to get the title ;)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.