public function before_render(&$template, &$content)
 {
     parent::before_render($template, $content);
     /*
      * Create the browser title.
      */
     if (strlen($content->get('browser_title')) === 0) {
         if (strlen($content->get('page_title')) > 0) {
             $content->set('browser_title', $content->get('page_title'));
             $content->append('browser_title', ' - ' . SITE_TITLE);
         } else {
             $content->set('browser_title', SITE_TITLE);
         }
     } else {
         $content->append('browser_title', ' - ' . SITE_TITLE);
     }
     /*
      * Include the place name (e.g., "Washington," "Texas," "United States").
      */
     $content->set('place_name', PLACE_NAME);
     /*
      * Get the edition data
      */
     $search = new Search();
     // Since we don't have any conditions in our template, we have to build
     // html here.
     if (!$content->is_set('current_edition') && defined('EDITION_ID')) {
         $content->set('current_edition', EDITION_ID);
     }
     $content->set('edition_select', $search->build_edition($content->get('current_edition')));
     /*
      * Set our search terms.
      */
     $query = '';
     if (isset($_GET['q'])) {
         $query = $_GET['q'];
     }
     $content->set('search_terms', $query);
     /*
      * If a Google Analytics Web Property ID has been provided, insert the tracking code.
      */
     if (defined('GOOGLE_ANALYTICS_ID')) {
         $content->prepend('javascript', "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n\t\t\t\t(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n\t\t\t\tm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n\t\t\t\t})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n\t\t\t\tga('create', '" . GOOGLE_ANALYTICS_ID . "', 'auto');\n\t\t\t\tga('send', 'pageview');");
     }
     /*
      * If a Typekit ID has been provided, insert the JavaScript.
      */
     if (defined('TYPEKIT_ID')) {
         $this->add_asset('typekit_js', array('path' => '//use.typekit.net/' . TYPEKIT_ID . '.js', 'type' => 'javascript'));
         $content->append('javascript', 'try{Typekit.load();}catch(e){};');
     }
     $content->append('javascript', 'var zclip_swf_file = "' . THEME_WEB_PATH . 'static/js/vendor/ZeroClipboard.swf";');
     /*
      * Setup assets
      */
     $this->render_assets($template, $content);
 }
 public function before_render(&$template, &$content)
 {
     parent::before_render($template, $content);
     /*
      * Create the browser title.
      */
     if (strlen($content->get('browser_title')) === 0) {
         if (strlen($content->get('page_title')) > 0) {
             $content->set('browser_title', $content->get('page_title'));
             $content->append('browser_title', '-' . SITE_TITLE);
         } else {
             $content->set('browser_title', SITE_TITLE);
         }
     } else {
         $content->append('browser_title', '—' . SITE_TITLE);
     }
     /*
      * Include the place name (e.g., "Washington," "Texas," "United States").
      */
     $content->set('place_name', PLACE_NAME);
     /*
      * If a Google Analytics Web Property ID has been provided, insert the tracking code.
      */
     if (defined('GOOGLE_ANALYTICS_ID')) {
         $content->append('javascript', "var _gaq = _gaq || [];\n\t\t\t\t  _gaq.push(['_setAccount', '" . GOOGLE_ANALYTICS_ID . "']);\n\t\t\t\t  _gaq.push(['_trackPageview']);\n\t\t\t\t  (function() {\n\t\t\t\t\tvar ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n\t\t\t\t\tga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n\t\t\t\t\tvar s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n\t\t\t\t  })();");
     }
     /*
      * If a Typekit ID has been provided, insert the JavaScript.
      */
     if (defined('TYPEKIT_ID')) {
         $this->add_asset('typekit_js', array('path' => '//use.typekit.net/' . TYPEKIT_ID . '.js', 'type' => 'javascript'));
         $content->append('javascript', 'try{Typekit.load();}catch(e){};');
     }
     $content->append('javascript', 'var zclip_swf_file = "' . THEME_WEB_PATH . 'static/js/vendor/ZeroClipboard.swf";');
     /*
      * Setup assets
      */
     $this->render_assets($template, $content);
 }