How to check if headTitle is already used?
To avoid appending or overwriting existing title, which was set earlier in parent views/layout.
Thanks 😉
Update
Example:
$this->headTitle('First title'); // index.phtml
$this->headTitle('Second title'); // some-nested-tpl.phtml
Check whether First title is set and assign Second if not.
You can simply check the content of headTitle and if it’s the default then write something else like:
Or write yourself a view-helper to safe yourself some writing time and have a function like
which does the above, so you have a short tag in your templates.