/** * Get a pages' path. Alias for $page->getPath() for compatibility reasons * For compatibility reasons, this path won't start with a slash! * @todo remove this method * * @param \Cx\Core\ContentManager\Model\Entity\Page $page * @return string path, e.g. 'This/Is/It' */ public function getPath($page) { return substr($page->getPath(), 1); }
/** * Returns the URL object for a page * @param \Cx\Core\ContentManager\Model\Entity\Page $page Page to get the URL to * @param array $parameters (optional) HTTP GET parameters to append * @param string $protocol (optional) The protocol to use * @return \Cx\Core\Routing\Url Url object for the supplied page */ public static function fromPage($page, $parameters = array(), $protocol = '') { if ($protocol == '') { $protocol = ASCMS_PROTOCOL; } $host = \Env::get('config')['domainUrl']; $offset = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath(); $path = $page->getPath(); $langDir = \FWLanguage::getLanguageCodeById($page->getLang()); $getParams = ''; if (count($parameters)) { $paramArray = array(); foreach ($parameters as $key => $value) { $paramArray[] = $key . '=' . $value; } $getParams = '?' . implode('&', $paramArray); } return new Url($protocol . '://' . $host . $offset . '/' . $langDir . $path . $getParams, true); }
public function getPath() { $this->_load(); return parent::getPath(); }