Frontend\Core\Engine\Header::parse PHP Method

parse() public method

Parse the header into the template
public parse ( )
    public function parse()
    {
        $this->parseFacebook();
        $this->parseSeo();
        // in debug mode we don't want our pages to be indexed.
        if ($this->getContainer()->getParameter('kernel.debug')) {
            $this->addMetaData(array('name' => 'robots', 'content' => 'noindex, nofollow'), true);
        }
        $this->parseMetaAndLinks();
        $this->parseCSS();
        $this->parseJS();
        $this->parseCustomHeaderHTMLAndGoogleAnalytics();
        $this->tpl->addGlobal('pageTitle', (string) $this->getPageTitle());
        $this->tpl->addGlobal('siteTitle', (string) $this->get('fork.settings')->get('Core', 'site_title_' . LANGUAGE, SITE_DEFAULT_TITLE));
    }

Usage Example

Example #1
0
 /**
  * Display the page
  */
 public function display()
 {
     // parse header
     $this->header->parse();
     // parse breadcrumb
     $this->breadcrumb->parse();
     // parse languages
     $this->parseLanguages();
     // parse footer
     $this->footer->parse();
     // assign the id so we can use it as an option
     $this->tpl->assign('isPage' . $this->pageId, true);
     $this->tpl->assign('isChildOfPage' . $this->record['parent_id'], true);
     // hide the cookiebar from within the code to prevent flickering
     $this->tpl->assign('cookieBarHide', !$this->get('fork.settings')->get('Core', 'show_cookie_bar', false) || CommonCookie::hasHiddenCookieBar());
     // the the positions to the template
     $this->parsePositions();
     // assign empty positions
     $unusedPositions = array_diff($this->record['template_data']['names'], array_keys($this->record['positions']));
     foreach ($unusedPositions as $position) {
         $this->tpl->assign('position' . \SpoonFilter::ucfirst($position), array());
     }
     // output
     return new Response($this->tpl->getContent($this->templatePath, false, true), $this->statusCode);
 }