if (!$position) { trigger_error('no position requested for ' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); exit; } require_once 'AMP/BaseTemplate.php'; $current_page =& AMPContent_Page::instance(); require_once 'AMP/Content/Template.inc.php'; require_once 'AMP/Content/Nav/Manager.inc.php'; $template = new AMPContent_Template(AMP_Registry::getDbcon(), $current_page->getTemplateId()); if (!$template->hasData()) { return false; } $header =& AMP_get_header(); $standard_js = $header->_HTML_javaScripts(); $template->setPage($current_page); $template->globalizeNavLayout(); $nav_manager = new NavigationManager($template, $current_page); $nav_output = $nav_manager->output(strtoupper(substr($position, 0, 1))); $new_js = $header->_HTML_javascripts(); $nav_js = array_diff(split("\n", $new_js), split("\n", $standard_js)); $nav_output = $nav_output . join("\n", $nav_js); /* $url = AMP_SITE_URL; $pattern = '/href\s?=\s?\'((?!http)[\w\d\.\/?= -]*)\'/i'; $replace = 'href="'.$url.'/$1"'; $data = preg_replace($pattern, $replace, $nav_output); $pattern = '/href\s?=\s?"((?!http)[\w\d\.\/?= -]*)"/i'; $replace = 'href="'.$url.'/$1"'; $data = preg_replace($pattern, $replace, $data);
/** * set the Template for use on the current page * * @param integer $template_id The database id of the Template to use * @access public * @since 3.5.3 * @return void */ function setTemplate($template_id) { require_once 'AMP/Content/Template.inc.php'; $template = new AMPContent_Template($this->_page->dbcon, $template_id); if (!$template->hasData()) { return false; } $template->setPage($this->_page); $this->_template =& $template; $template->globalizeNavLayout(); }