Example usage for place holders:
- doctype()
- headTitle()
- headMeta()
- headLink()
- headStyle()
- headScript()
- inlineScript()
DOCTYPE
$view->doctype('HTML5');
Title
$view->headTitle('Site Title'); $view->headTitle('Site Title') ->setSeparator(' :: ');
Meta
$view->headMeta()->appendName('keywords', 'page, keywords') ->appendName('description', 'page description') ->appendName('author', 'author name');
Refresh
$view->headMeta()->appendHttpEquiv('Refresh','30');
Redirect
$view->headMeta()->appendHttpEquiv('Refresh','0;url=http://www.ggshow.com');
Disable client side cache
$view->headMeta()->appendHttpEquiv('expires','-1') ->appendHttpEquiv('pragma', 'no-cache') ->appendHttpEquiv('Cache-Control', 'no-cache');
Setting content type and character set
$view->headMeta()->setCharset('utf-8'); $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ->appendHttpEquiv('Content-Language', 'en-US');
Favicon with headLink
$view->headLink(array('rel' => 'favicon', 'href' => 'favicon.ico'),'PREPEND'); $view->headLink(array('rel' => 'shortcut icon', 'type' => 'image/x-icon', 'href' => 'favicon.ico'),'PREPEND');
CSS with headLink
$view->headLink()->appendStylesheet('style.css');
// appendStylesheet, prependStylesheet, setStylesheet, offsetStylesheet, appendAlternative, prependAlternative, setAlternative, offsetAlternative
CSS with headStyle
$view->headStyle->captureStart(); ?> body { margin: 0; } <?php $view->headStyle->captureEnd();
JavaScript
$view->headScript()->appendFile(“script.js”); $view->headScript()->prependFile(“script.js”); $view->inlineScript()->appendFile(“script.js”); $this->headScript()->appendFile('script.js', 'text/javascript', array('conditional' => 'lt IE 7') );
Example output (within layout/view)
echo $this->headTitle(); echo $this->headLink(); echo $this->headMeta(); echo htmlentities($view->headMeta()->setPostfix("n"));
Example layout with placeholders
<?php echo $this->doctype() ?> <html> <head> <?php echo $this->headTitle() ?> <?php echo $this->headScript() ?> <?php echo $this->headStyle() ?> </head> <body> <?php echo $this->layout()->content; ?> <?php echo $this->inlineScript() ?> </body> </html>