当前位置: 首页>>代码示例>>PHP>>正文


PHP Pages::getPageUrl方法代码示例

本文整理汇总了PHP中Pages::getPageUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Pages::getPageUrl方法的具体用法?PHP Pages::getPageUrl怎么用?PHP Pages::getPageUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pages的用法示例。


在下文中一共展示了Pages::getPageUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_function_pageurl

function smarty_function_pageurl($params, Smarty_Internal_Template $template)
{
    $output = '';
    if (isset($params['page'])) {
        if (isset($params['language'])) {
            $language_id = $params['language'];
        } else {
            $language_id = $template->getTemplateVars('languageId');
            if ($language_id === null) {
                $language_id = Config::get()->languages->standard;
            }
        }
        $mixed_id = $params['page'];
        $page_id = false;
        $pages = new Pages();
        if (is_int($mixed_id)) {
            $page_id = $mixed_id;
        } else {
            if (is_numeric($mixed_id)) {
                $page_id = (int) $mixed_id;
            } else {
                if (is_string($mixed_id)) {
                    $page_id = $pages->getPageIdByUniqueId($mixed_id);
                }
            }
        }
        if ($page_id !== false) {
            $output = $pages->getPageUrl($page_id, $language_id);
        }
    }
    return $output;
}
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:32,代码来源:function.pageurl.php

示例2: getlinkAction

 public function getlinkAction()
 {
     // Parameter auslesen
     $link_to_page_id = Request::postParam('linkToPageId');
     $link_to_language_id = Request::postParam('linkToLanguageId');
     $link_to_anchor_name = Request::postParam('linkToAnchorName');
     // Parameter überprüfen
     if (!is_numeric($link_to_page_id) || $link_to_language_id == '') {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     $pages = new Pages();
     // Die absolute URL auslesen
     $absolute_url = $pages->getPageUrl($link_to_page_id, $link_to_language_id);
     // eine zum Stammverzeichnis des CMS relative URL daraus machen
     $base_url = Config::get()->baseUrl;
     $relative_url = UTF8String::substr($absolute_url, UTF8String::strlen($base_url), UTF8String::strlen($absolute_url));
     if ($link_to_anchor_name != '') {
         if ($relative_url != '') {
             $relative_url = rtrim($relative_url, '/') . '/';
         }
         $relative_url .= '#' . $link_to_anchor_name;
     }
     // Zurückgeben
     $this->success($relative_url);
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:26,代码来源:Linkselector.php

示例3: getPage

 public function getPage($page_id, $language_id, $preview = false)
 {
     // Smarty initialisieren
     $smarty = new Template();
     // Seiten-Infos laden
     $pages = new Pages();
     $page_properties = $pages->getProperties($page_id);
     if ($page_properties === false) {
         Helpers::fatalError('A page with the ID "' . $page_id . '" does not exist!');
     }
     // Wenn die Vorschau-Version der Seite angefordert wurde,
     // überprüfen, ob überhaupt eine editierte Version der Seite existiert,
     // wenn nicht, Vorschau-Modus ignorieren
     if ($preview) {
         if ($page_properties['status'] == Pages::STATUS_PUBLISHED) {
             $preview = false;
         }
     }
     // Seiteneigenes Verzeichnis abhängig von $preview auslesen
     if ($preview) {
         $page_files = $pages->getPageFilesEditFolder($page_id, $page_properties);
         $page_files_url = $pages->getPageFilesEditUrl($page_id, $page_properties);
     } else {
         $page_files = $pages->getPageFilesPublishedFolder($page_id, $page_properties);
         $page_files_url = $pages->getPageFilesPublishedUrl($page_id, $page_properties);
     }
     $page_url = $pages->getPageUrl($page_id, $language_id, $page_properties);
     // Grundlegende Variablen zuweisen, die zwar mit dem Inhalt nichts zu tun haben, aber wichtig sind :-)
     $smarty->assign('baseUrl', Config::get()->baseUrl);
     $smarty->assign('publicUrl', Config::get()->baseUrl . 'system/custom/frontend/public/');
     $smarty->assign('pageUrl', $page_url);
     $smarty->assign('pageId', $page_id);
     $smarty->assign('languageId', $language_id);
     $smarty->assign('templateId', $page_properties['template-id']);
     $smarty->assign('uniqueId', $page_properties['unique-id']);
     $smarty->assign('pageFiles', $page_files);
     $smarty->assign('pageFilesUrl', $page_files_url);
     $languages = Config::get()->languages->list->getArrayCopy();
     foreach ($languages as $key => $value) {
         $languages[$key]['id'] = $key;
     }
     $smarty->assign('languages', $languages);
     // Seiten-Struktur laden
     $pages_structure = DataStructure::pagesArray();
     if (!isset($pages_structure[$page_properties['template-id']]['structure'])) {
         Helpers::fatalError('A page template with the ID "' . $page_properties['template-id'] . '" does not exist!');
     }
     $page_structure = $pages_structure[$page_properties['template-id']]['structure'];
     // Die folgenden Parameter werden an die Modifikatoren und Plugins übergeben
     $parameters = array('preview' => $preview, 'pageId' => $page_id, 'languageId' => $language_id, 'templateId' => $page_properties['template-id'], 'uniqueId' => $page_properties['unique-id'], 'pageUrl' => $page_url, 'pageFiles' => $page_files, 'pageFilesUrl' => $page_files_url, 'smarty' => $smarty);
     // Seiten-Inhalt laden
     $content_object = new PageContent();
     if (!$content_object->load($page_id, !$preview)) {
         Helpers::fatalError('The content of the page with the ID "' . $page_id . '" could not be loaded!');
     }
     $page_content = $content_object->getArray($language_id, $smarty, $parameters);
     // Globale Elemente laden
     $this->loadGlobalElementsPage($smarty, $language_id);
     $this->assignGlobalElementsToSmarty($smarty, $language_id);
     // Inhalte zuweisen
     foreach ($page_structure as $block_id => $block) {
         if ($block['type'] == 'datablock') {
             $block_data = null;
             if (isset($page_content[$block_id])) {
                 $block_data = $page_content[$block_id];
             }
             $smarty->assign($block_id, $block_data);
         } elseif ($block['type'] == 'container') {
             $container_content = '';
             if (isset($page_content[$block_id])) {
                 if (is_array($page_content[$block_id])) {
                     foreach ($page_content[$block_id] as $container_element_key => $container_element) {
                         $container_content = $container_content . $this->getElement($page_id, $language_id, $container_element['elementId'], $container_element['content'], $preview);
                     }
                 }
             }
             $smarty->assign($block_id, $container_content);
         }
     }
     // registrierte Plugins aufrufen, vielleicht hat ja noch jemand etwas hinzuzufügen :-)
     Plugins::call(Plugins::ASSIGN_PAGE_DATA, $parameters);
     // Smarty-Template für die Template-ID der aktuellen Seite zurückgeben
     $page_template = $pages_structure[$page_properties['template-id']];
     return $smarty->fetch('file:[pages]' . $page_template['template']);
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:85,代码来源:StandardPageBuilder.php


注:本文中的Pages::getPageUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。