Reputation: 25807
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
Upvotes: 1
Views: 3006
Reputation: 11217
Easiest solution by far to get the returned value of view helper:
$titleTag = (string)$this->headTitle(); //with title tag, use strip tags to get the title ;)
Upvotes: 0
Reputation: 614
In view
$this->headTitle('some browser title');
echo $this->headTitle(); //<title>some browser title<title>
echo strip_tags($this->headTitle()); //some browser title
Upvotes: 8
Reputation: 13632
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).
Upvotes: 0
Reputation: 2620
Think it should be:
$this->view->headTitle('some browser title')
;
to set the page title.
Upvotes: 1