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


PHP waSystem::getAppUrl方法代码示例

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


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

示例1: pages

 public function pages($parent_id = 0, $with_params = true)
 {
     if (is_bool($parent_id)) {
         $with_params = $parent_id;
         $parent_id = 0;
     }
     try {
         $page_model = $this->getPageModel();
         $sql = "SELECT id, parent_id, name, title, full_url, url, create_datetime, update_datetime FROM " . $page_model->getTableName() . '
                 WHERE status = 1 AND domain = s:domain AND route = s:route ORDER BY sort';
         $pages = $page_model->query($sql, array('domain' => wa()->getRouting()->getDomain(null, true), 'route' => wa()->getRouting()->getRoute('url')))->fetchAll('id');
         if ($with_params) {
             $page_params_model = $page_model->getParamsModel();
             $data = $page_params_model->getByField('page_id', array_keys($pages), true);
             foreach ($data as $row) {
                 if (isset($pages[$row['page_id']])) {
                     $pages[$row['page_id']][$row['name']] = $row['value'];
                 }
             }
         }
         // get current rool url
         $url = $this->wa->getAppUrl(null, true);
         foreach ($pages as &$page) {
             $page['url'] = $url . $page['full_url'];
             if (!isset($page['title']) || !$page['title']) {
                 $page['title'] = $page['name'];
             }
             foreach ($page as $k => $v) {
                 if ($k != 'content') {
                     $page[$k] = htmlspecialchars($v);
                 }
             }
         }
         unset($page);
         // make tree
         foreach ($pages as $page_id => $page) {
             if ($page['parent_id'] && isset($pages[$page['parent_id']])) {
                 $pages[$page['parent_id']]['childs'][] =& $pages[$page_id];
             }
         }
         foreach ($pages as $page_id => $page) {
             if ($page['parent_id']) {
                 unset($pages[$page_id]);
             }
         }
         if ($parent_id) {
             return isset($pages[$parent_id]['childs']) ? $pages[$parent_id]['childs'] : array();
         }
         return $pages;
     } catch (Exception $e) {
         return array();
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:53,代码来源:waAppViewHelper.class.php

示例2: prepare

 protected function prepare()
 {
     $this->assign('wa_url', $this->system->getRootUrl());
     $this->assign('wa_backend_url', waSystem::getInstance()->getConfig()->getBackendUrl(true));
     $this->assign('wa_app', $this->system->getApp());
     $this->assign('wa_app_url', $this->system->getAppUrl(null, true));
     $this->assign('wa_app_static_url', $this->system->getAppStaticUrl());
     if (!$this->helper) {
         $this->helper = new waViewHelper($this);
     }
     $this->assign('wa', $this->helper);
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:12,代码来源:waView.class.php

示例3: pages

 public function pages($parent_id = 0, $with_params = true)
 {
     if (is_bool($parent_id)) {
         $with_params = $parent_id;
         $parent_id = 0;
     }
     try {
         $page_model = $this->getPageModel();
         $domain = wa()->getRouting()->getDomain(null, true);
         if ($this->wa->getConfig()->getApplication() == wa()->getRouting()->getRoute('app')) {
             $route = wa()->getRouting()->getRoute('url');
             $url = $this->wa->getAppUrl(null, true);
         } else {
             $routes = wa()->getRouting()->getByApp($this->wa->getConfig()->getApplication(), $domain);
             if ($routes) {
                 $route = end($routes);
                 $route = $route['url'];
                 $url = wa()->getRootUrl(false, true) . waRouting::clearUrl($route);
             } else {
                 return array();
             }
         }
         $pages = null;
         $cache_key = $domain . '/' . waRouting::clearUrl($route);
         if ($cache = $this->wa->getCache()) {
             $pages = $cache->get($cache_key, 'pages');
         }
         if ($pages === null) {
             $pages = $page_model->getPublishedPages($domain, $route);
             if ($with_params && $pages) {
                 $page_params_model = $page_model->getParamsModel();
                 $data = $page_params_model->getByField('page_id', array_keys($pages), true);
                 foreach ($data as $row) {
                     if (isset($pages[$row['page_id']])) {
                         $pages[$row['page_id']][$row['name']] = $row['value'];
                     }
                 }
             }
             foreach ($pages as &$page) {
                 $page['url'] = $url . $page['full_url'];
                 if (!isset($page['title']) || !$page['title']) {
                     $page['title'] = $page['name'];
                 }
                 foreach ($page as $k => $v) {
                     if ($k != 'content') {
                         $page[$k] = htmlspecialchars($v);
                     }
                 }
             }
             unset($page);
             foreach ($pages as $page_id => $page) {
                 if ($page['parent_id'] && isset($pages[$page['parent_id']])) {
                     $pages[$page['parent_id']]['childs'][] =& $pages[$page_id];
                 }
             }
             if ($cache) {
                 $cache->set($cache_key, $pages, 3600, 'pages');
             }
         }
         if ($parent_id) {
             return isset($pages[$parent_id]['childs']) ? $pages[$parent_id]['childs'] : array();
         }
         foreach ($pages as $page_id => $page) {
             if ($page['parent_id']) {
                 unset($pages[$page_id]);
             }
         }
         return $pages;
     } catch (Exception $e) {
         return array();
     }
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:72,代码来源:waAppViewHelper.class.php


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