Ben
Ben

Reputation: 25807

Zend Framework :: How should title html element get from view?(set view->headTitle())

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

Answers (4)

Tom&#225;š Fejfar
Tom&#225;š Fejfar

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

ngsiolei
ngsiolei

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

William
William

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

simnom
simnom

Reputation: 2620

Think it should be:

$this->view->headTitle('some browser title');

to set the page title.

Upvotes: 1

Related Questions