php - Adding custom HTML to <head> tag in Zend Framework 2 -


i'm trying add custom html tags head script in layout via. controller. ultimate goal add following inside head tags:

<noscript><meta http-equiv="refresh" content="5"></noscript> 

i'm able add refresh meta tag using $headmeta->appendhttpequiv(), have no idea how can wrap in <noscript></noscript> tags. needs added 1 page, don't want separate layout file this. want use whatever methods , functions zf2 have on offer (if fit bill). i've gone through documented view helpers, can't find 1 help.

any ideas?

you should able placeholder helper.

in layout:

<html>     <head>         <?=$this->placeholder('customhead')?>      [etc.] 

then in view the page want on:

$this->placeholder('customhead')->set('<noscript><meta http-equiv="refresh" content="5"></noscript>'); 

change customhead whatever name want.

edit: yes, can in controller action instead:

public function someaction() {     $viewhelpermanager = $this->getservicelocator()->get('viewhelpermanager');     $placeholder = $viewhelpermanager->get('placeholder');     $placeholder->getcontainer('customhead')->set('<noscript><meta http-equiv="refresh" content="5"></noscript>'); } 

if it's need in more 1 place might wish inject placeholder helper controller dependency.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -