當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FrontController::getURLByRoute方法代碼示例

本文整理匯總了PHP中FrontController::getURLByRoute方法的典型用法代碼示例。如果您正苦於以下問題:PHP FrontController::getURLByRoute方法的具體用法?PHP FrontController::getURLByRoute怎麽用?PHP FrontController::getURLByRoute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FrontController的用法示例。


在下文中一共展示了FrontController::getURLByRoute方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _getSubscribeLink

 protected function _getSubscribeLink($email, $user_id, $st_id)
 {
     return FrontController::getURLByRoute('unsubscribe', array('user_id' => $user_id, 'statement_id' => $st_id, 'email' => $email, 'hash' => $this->_getSubscribeHash($email, $user_id, $st_id)), true);
 }
開發者ID:dautushenka,項目名稱:DLE-Statement,代碼行數:4,代碼來源:SubscribeEvent.php

示例2: PageNavigation

 public function PageNavigation($route, $count_all, $per_page, array $options = array())
 {
     $default_options = array();
     $options = array_merge($default_options, $options);
     $request = FrontController::getRequest();
     $page = $request->getClean('page');
     if ((int) $page <= 0) {
         $page = 1;
     }
     $i = $per_page * $page > $count_all ? $count_all : $per_page * $page;
     $this->_tpl->load_template('navigation.tpl');
     $vars = array();
     $blocks = array();
     $no_prev = false;
     $no_next = false;
     $cstart = ((int) $page - 1) * $per_page;
     if (isset($cstart) and $cstart != "" and $cstart > 0) {
         $prev = $cstart / $per_page;
         if ($prev > 1) {
             $page_url = FrontController::getURLByRoute($route . "_pages", array('page' => $prev));
         } else {
             $page_url = FrontController::getURLByRoute($route);
         }
         $blocks['prev-link'] = "<a href=\"" . $page_url . "\">\\1</a>";
     } else {
         $no_prev = TRUE;
     }
     if ($per_page) {
         if ($count_all > $per_page) {
             $enpages_count = @ceil($count_all / $per_page);
             $pages = "";
             $cstart = $cstart / $per_page + 1;
             if ($enpages_count <= 10) {
                 for ($j = 1; $j <= $enpages_count; $j++) {
                     if ($j > 1) {
                         $page_url = FrontController::getURLByRoute($route . "_pages", array('page' => $j));
                     } else {
                         $page_url = FrontController::getURLByRoute($route);
                     }
                     if ($j != $cstart) {
                         $pages .= "<a href=\"" . $page_url . "\">{$j}</a> ";
                     } else {
                         $pages .= "<span>{$j}</span> ";
                     }
                 }
             } else {
                 $start = 1;
                 $end = 10;
                 $nav_prefix = "... ";
                 if ($cstart > 0) {
                     if ($cstart > 5) {
                         $start = $cstart - 4;
                         $end = $start + 8;
                         if ($end >= $enpages_count) {
                             $start = $enpages_count - 9;
                             $end = $enpages_count - 1;
                             $nav_prefix = "";
                         } else {
                             $nav_prefix = "... ";
                         }
                     }
                 }
                 if ($start >= 2) {
                     $pages .= "<a href=\"" . FrontController::getURLByRoute($route) . "\">1</a> ... ";
                 }
                 for ($j = $start; $j <= $end; $j++) {
                     if ($j > 1) {
                         $page_url = FrontController::getURLByRoute($route . "_pages", array('page' => $j));
                     } else {
                         $page_url = FrontController::getURLByRoute($route);
                     }
                     if ($j != $cstart) {
                         $pages .= "<a href=\"" . $page_url . "\">{$j}</a> ";
                     } else {
                         $pages .= "<span>{$j}</span> ";
                     }
                 }
                 if ($cstart != $enpages_count) {
                     $pages .= $nav_prefix . "<a href=\"" . FrontController::getURLByRoute($route . "_pages", array('page' => $enpages_count)) . "\">{$enpages_count}</a>";
                 } else {
                     $pages .= "<span>{$enpages_count}</span> ";
                 }
             }
         }
         $vars['pages'] = $pages;
     }
     if ($per_page and $per_page < $count_all and $i < $count_all) {
         $next_page = @floor($i / $per_page) + 1;
         $blocks['next-link'] = "<a href=\"" . FrontController::getURLByRoute($route . "_pages", array('page' => $next_page)) . "\">\\1</a>";
     } else {
         $no_next = TRUE;
     }
     if (!$no_prev or !$no_next) {
         $this->_fillTmpl($vars, $blocks);
         return $this->_compile('PageNavigation');
     }
     return '';
 }
開發者ID:dautushenka,項目名稱:DLE-Statement,代碼行數:98,代碼來源:Views.php

示例3: onNewComment

 public function onNewComment(FrontController $sender, Comment $comment, Statement $st)
 {
     $vars = array('username' => $comment->getUsername(), 'text' => strip_tags($comment->getText()), 'st_link' => FrontController::getURLByRoute('@view', array('id' => $st->getId()), true), 'title' => $st->getTitle());
     $this->getMailer()->sendMail('newComment', $this->_getModerEmails(), $vars);
 }
開發者ID:dautushenka,項目名稱:DLE-Statement,代碼行數:5,代碼來源:MailsEvent.php


注:本文中的FrontController::getURLByRoute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。