Frontend\Core\Engine\Navigation::getURL PHP 메소드

getURL() 공개 정적인 메소드

Get URL for a given pageId
public static getURL ( integer $pageId, string $language = null ) : string
$pageId integer The pageID wherefore you want the URL.
$language string The language wherein the URL should be retrieved, if not provided we will load the language that was provided in the URL.
리턴 string
    public static function getURL($pageId, $language = null)
    {
        $pageId = (int) $pageId;
        $language = $language !== null ? (string) $language : LANGUAGE;
        // init URL
        $url = FrontendModel::getContainer()->getParameter('site.multilanguage') ? '/' . $language . '/' : '/';
        // get the menuItems
        $keys = self::getKeys($language);
        // get the URL, if it doesn't exist return 404
        if (!isset($keys[$pageId])) {
            return self::getURL(404, $language);
        } else {
            $url .= $keys[$pageId];
        }
        // return the URL
        return urldecode($url);
    }

Usage Example

예제 #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     //--Get the id
     $id = $this->URL->getParameter(1);
     //--check if the id is not empty
     if (empty($id)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     //--Explode the id
     $ids = explode("-", $id);
     //--check if the id contains 2 elements
     if (count($ids) != 2) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     //--Get the ids and decrypt
     $send_id = (int) FrontendMailengineModel::decryptId($ids[0]);
     $user_id = (int) FrontendMailengineModel::decryptId($ids[1]);
     //--check if the ids are integers
     if ($send_id <= 0) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     if ($user_id > 0) {
         $data = array();
         $data["send_id"] = $send_id;
         $data["user_id"] = $user_id;
         //--Add open-mail to the database
         FrontendMailengineModel::insertMailOpen($data);
     }
     //--Create an empty image
     $this->createImage();
     //--Stop the script
     die;
 }
All Usage Examples Of Frontend\Core\Engine\Navigation::getURL