remithomas / rt-headtitle
ZF2 Plugin to set title easily to your pages from controllers actions
Installs: 33 694
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 0
Forks: 1
Open Issues: 1
pkg:composer/remithomas/rt-headtitle
Requires
- php: >=5.3.3
- zendframework/zend-eventmanager: 2.*
- zendframework/zend-modulemanager: 2.*
- zendframework/zend-mvc: 2.*
This package is not auto-updated.
Last update: 2025-10-25 18:39:20 UTC
README
ZF2 HeadTitle plugin, you can easily set any title within yours controllers actions
Features / Goals
- Set and manage your titles from controllers actions
How to install ?
Using composer.json
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"minimum-stability": "dev",
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "dev-master",
"remithomas/rt-headtitle": "dev-master"
}
}
Activate the module :
application.config.php
<?php return array( 'modules' => array( 'Application', 'RtHeadtitle', ) ); ?>
Only activated in one module
If you need to use this plugin only in one module. Just copy this code and add it into your own module config (module.config.php)
<?php return array( 'controller_plugins' => array( 'invokables' => array( 'HeadTitle' => 'RtHeadtitle\Controller\Plugin\HeadTitle', ) ), ...
Activated for all the application
If you need to use this plugin in all your application. Just copy the file rt-headtitle.global.php.dist (/vendor/remithomas/rt-headtitle/config/) and paste it into the folder /config/autoload/
Change your Layout.phtml
<html lang="en">
<head>
<?php echo $this->headTitle(); ?>
</head>
<body>content</body>
</html>
How to use ?
How to use in your controller action !
public function indexAction(){ $this->headTitle("My website")->setSeparator(" - ")->append("easy ?!"); return new ViewModel(); }