View Helper HeadTitle without TITLE tags
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
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
- Edited:
-
leek
- Revision Id:
- 74
- Edit Message:
- Fixed with Stevens advice
- Tags:
- view helper
- Comments:
- 2
- Views:
- 184
- Points:
- 1 (1 votes)
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.
:)