htmlHelper::header PHP Method

header() public method

Returns an HTML header and opens the body container This method will trigger an error if executed more than once without first calling the footer() method on the prior usage This is meant to be utilized within layouts, not views (but will work in either)
public header ( array $args ) : string
$args array
return string
    public function header(array $args)
    {
        if (!$this->_bodyOpen) {
            $this->_bodyOpen = true;
            extract($args);
            $return = $this->_docType . PHP_EOL . '<html xmlns="http://www.w3.org/1999/xhtml">' . PHP_EOL . '<head>' . PHP_EOL . '<title>' . $title . '</title>';
            if (!isset($metaheader['Content-Type'])) {
                $metaheader['Content-Type'] = 'text/html; charset=utf-8';
            }
            foreach ($metaheader as $name => $content) {
                $return .= PHP_EOL . '<meta http-equiv="' . $name . '" content="' . $content . '" />';
            }
            $meta['generator'] = 'Vork 2.00';
            foreach ($meta as $name => $content) {
                $return .= PHP_EOL . '<meta name="' . $name . '" content="' . $content . '" />';
            }
            if (isset($favicon)) {
                $return .= PHP_EOL . '<link rel="shortcut icon" href="' . $favicon . '" type="image/x-icon" />';
            }
            if (isset($animatedFavicon)) {
                $return .= PHP_EOL . '<link rel="icon" href="' . $animatedFavicon . '" type="image/gif" />';
            }
            $containers = array('css', 'cssInline', 'js', 'jsInline', 'jqueryTheme');
            foreach ($containers as $container) {
                if (isset(${$container})) {
                    $return .= PHP_EOL . $this->{$container}(${$container});
                }
            }
            if ($this->vorkHead) {
                //used internally by Vork tools
                foreach ($this->vorkHead as $container => $objArray) {
                    //works only for inline code, not external files
                    $return .= PHP_EOL . $this->{$container}(implode(PHP_EOL, $objArray));
                }
            }
            if (isset($head)) {
                $return .= PHP_EOL . (is_array($head) ? implode(PHP_EOL, $head) : $head);
            }
            $return .= PHP_EOL . '</head>' . PHP_EOL . '<body>';
            return $return;
        } else {
            $errorMsg = 'Invalid usage of ' . __METHOD__ . '() - the header has already been returned';
            trigger_error($errorMsg, E_USER_NOTICE);
        }
    }