Zend Framework Source Code Snippets

View Helper HeadTitle without TITLE tags

Bookmark and Share
1
2
3
4
56
7
8
class Core_View_Helper_Title extends Zend_View_Helper_Abstract
{
    public function title()
    {
        $headTitle = $this->view->headTitle();        return strip_tags($headTitle->toString());
    }
}

Comments

Steven Steven
1 year ago

Hi Leek,

Useful tip: if your helper class extends Zend_View_Helper_Abstract (as yours does), you will have access to the view object already. It is set as a public property of your view helper object.

So in your case, you would omit the first line of your title method and just access $this->view.

:)

leek leek
1 year ago

Thanks! Fixed :)

You must login before commenting on a snippet. If you do not have an account, please register.

Snippet description

Quick/Simple/Dirty View Helper to retrieve the current page title without the surrounding <title> tags.

Snippet details

Created:
leek leek
1 year ago
Edited:
leek leek
1 year ago
Revision Id:
74
Edit Message:
Fixed with Stevens advice
Tags:
view helper
Comments:
2
Views:
184
Points:
1 (1 votes)

History

r74

Fixed with Stevens advice

leek leek
1 year ago
diff
r71

Initial Release

leek leek
1 year ago
diff
r70

Initial Release

leek leek
1 year ago