Question

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

Was it helpful?

Solution

In view

$this->headTitle('some browser title');
echo $this->headTitle(); //<title>some browser title<title>
echo strip_tags($this->headTitle()); //some browser title

OTHER TIPS

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).

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 ;)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top