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


PHP aTools::urlForPage方法代码示例

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


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

示例1: redirectToPage

 protected function redirectToPage()
 {
     // Used for non-AJAX edits of global slots so that we can
     // redirect back to the real page after the edit succeeds
     if ($this->hasRequestParameter('actual_slug')) {
         return $this->redirect(aTools::urlForPage($this->getRequestParameter('actual_slug')));
     } else {
         return $this->redirect($this->page->getUrl());
     }
 }
开发者ID:verenate,项目名称:gri,代码行数:10,代码来源:BaseaSlotActions.class.php

示例2: link_to

-<?php 
    echo $item['id'];
    ?>
">

      <?php 
    if (isset($item['external']) && $item['external']) {
        ?>
        <?php 
        echo link_to($item['title'], $item['slug']);
        ?>
      <?php 
    } else {
        ?>
        <?php 
        echo link_to($item['title'], aTools::urlForPage($item['slug'], array('absolute' => true)));
        ?>
      <?php 
    }
    ?>

      <?php 
    if (isset($item['children']) && count($item['children']) && $nest < $maxDepth) {
        ?>
        <?php 
        include_partial('aNavigation/accordion', array('nav' => $item['children'], 'draggable' => $draggable, 'maxDepth' => $maxDepth - 1, 'name' => $name, 'nest' => $nest + 1, 'dragIcon' => $dragIcon, 'class' => $class, 'active' => $active));
        ?>
      <?php 
    }
    ?>
开发者ID:hashir,项目名称:UoA,代码行数:30,代码来源:_accordion.php

示例3: executeSearch


//.........这里部分代码省略.........
         if ($published_at > $now) {
             continue;
         }
         // 1.5: the names under which we store columns in Zend Lucene have changed to
         // avoid conflict with also indexing them
         $info = unserialize($document->getFieldValue('info_stored'));
         if (!aPageTable::checkPrivilege('view', $info)) {
             continue;
         }
         $slug = $document->getFieldValue('slug_stored');
         if (substr($slug, 0, 1) !== '@' && strpos($slug, '/') === false) {
             // A virtual page slug which is not a route is not interested in being part of search results
             continue;
         }
         $nvalues[] = $value;
     }
     $values = $nvalues;
     if ($this->searchAddResults($values, $q)) {
         foreach ($values as $value) {
             if (get_class($value) === 'stdClass') {
                 // bc with existing implementations of searchAddResults
                 if (!isset($value->slug_stored)) {
                     if (isset($value->slug)) {
                         $value->slug_stored = $value->slug;
                     } else {
                         $value->slug_stored = null;
                     }
                 }
                 if (!isset($value->title_stored)) {
                     $value->title_stored = $value->title;
                 }
                 if (!isset($value->summary_stored)) {
                     $value->summary_stored = $value->summary;
                 }
                 if (!isset($value->engine_stored)) {
                     if (isset($value->engine)) {
                         $value->engine_stored = $value->engine;
                     } else {
                         $value->engine_stored = null;
                     }
                 }
             }
         }
         // $value = new stdClass();
         // $value->url = $url;
         // $value->title = $title;
         // $value->score = $scores[$id];
         // $value->summary = $summary;
         // $value->class = 'Article';
         // $values[] = $value;
         usort($values, "aActions::compareScores");
     }
     $this->pager = new aArrayPager(null, sfConfig::get('app_a_search_results_per_page', 10));
     $this->pager->setResultArray($values);
     $this->pager->setPage($request->getParameter('page', 1));
     $this->pager->init();
     $this->pagerUrl = "a/search?" . http_build_query(array("q" => $q));
     // setTitle takes care of escaping things
     $this->getResponse()->setTitle(aTools::getOptionI18n('title_prefix') . 'Search for ' . $q . aTools::getOptionI18n('title_suffix'));
     $results = $this->pager->getResults();
     // Now that we have paginated and obtained the short list of results we really
     // care about it's OK to use the lazy load features of Lucene for the last mile
     $nresults = array();
     foreach ($results as $value) {
         $nvalue = $value;
         $nvalue->slug = $nvalue->slug_stored;
         $nvalue->title = $nvalue->title_stored;
         $nvalue->summary = $nvalue->summary_stored;
         if (strlen($nvalue->engine_stored)) {
             $helperClass = $nvalue->engine_stored . 'SearchHelper';
             if (class_exists($helperClass)) {
                 $searchHelper = new $helperClass();
                 $nvalue->partial = $searchHelper->getPartial();
             }
         }
         if (!isset($nvalue->url)) {
             if (substr($nvalue->slug, 0, 1) === '@') {
                 // Virtual page slug is a named Symfony route, it wants search results to go there
                 $nvalue->url = $this->getController()->genUrl($nvalue->slug, true);
             } else {
                 $slash = strpos($nvalue->slug, '/');
                 if ($slash === false) {
                     // A virtual page (such as global) that isn't the least bit interested in
                     // being part of search results
                     continue;
                 }
                 if ($slash > 0) {
                     // A virtual page slug which is a valid Symfony route, such as foo/bar?id=55
                     $nvalue->url = $this->getController()->genUrl($nvalue->slug, true);
                 } else {
                     // A normal CMS page
                     $nvalue->url = aTools::urlForPage($nvalue->slug);
                 }
             }
         }
         $nvalue->class = 'aPage';
         $nresults[] = $nvalue;
     }
     $this->results = $nresults;
 }
开发者ID:hashir,项目名称:UoA,代码行数:101,代码来源:BaseaActions.class.php

示例4: a_navtree_body

function a_navtree_body($children)
{
    $s = "<ul>\n";
    foreach ($children as $info) {
        $s .= '<li>' . link_to($info['title'], aTools::urlForPage($info['slug']));
        if (isset($info['children'])) {
            $s .= a_navtree_body($info['children']);
        }
        $s .= "</li>\n";
    }
    $s .= "</ul>\n";
    return $s;
}
开发者ID:hashir,项目名称:UoA,代码行数:13,代码来源:aHelper.php

示例5: _a_navcolumn_body

function _a_navcolumn_body($page)
{
    $sortHandle = "";
    $sf_user = sfContext::getInstance()->getUser();
    $admin = $page->userHasPrivilege('edit');
    if ($admin) {
        $sortHandle = "<div class='a-btn icon a-drag a-controls'></div>";
    }
    $result = "";
    // Inclusion of archived pages should be a bit generous to allow for tricky situations
    // in which those who can edit a subpage might not be able to find it otherwise.
    // We don't want the performance hit of checking for the right to edit each archived
    // subpage, so just allow those with potential-editor privs to see that archived pages
    // exist, whether or not they are allowed to actually edit them
    if (aTools::isPotentialEditor() && $sf_user->getAttribute('show-archived', true, 'apostrophe')) {
        $livingOnly = false;
    } else {
        $livingOnly = true;
    }
    $result = '<ul id="a-navcolumn" class="a-navcolumn">';
    $childrenInfo = $page->getChildrenInfo($livingOnly);
    if (!count($childrenInfo)) {
        $childrenInfo = $page->getPeerInfo($livingOnly);
    }
    $n = 1;
    foreach ($childrenInfo as $childInfo) {
        $class = "peer_item";
        if ($childInfo['id'] == $page->id) {
            $class = "self_item";
        }
        if ($n == 1) {
            $class .= ' first';
        }
        if ($n == count($childrenInfo)) {
            $class .= ' last';
        }
        // Specific format to please jQuery.sortable
        $result .= "<li id=\"a-navcolumn-item-" . $childInfo['id'] . "\" class=\"a-navcolumn-item {$class}\">\n";
        $title = $childInfo['title'];
        if ($childInfo['archived']) {
            $title = '<span class="a-archived-page" title="&quot;' . $title . '&quot; is Unpublished">' . $title . '</span>';
        }
        $result .= $sortHandle . link_to($title, aTools::urlForPage($childInfo['slug']));
        $result .= "</li>\n";
        $n++;
    }
    $result .= "</ul>\n";
    if ($admin) {
        $result .= jq_sortable_element('#a-navcolumn', array('url' => 'a/sort?page=' . $page->getId()));
    }
    return $result;
}
开发者ID:verenate,项目名称:gri,代码行数:52,代码来源:aHelper.php

示例6: executeSearch

 public function executeSearch(sfWebRequest $request)
 {
     // create the array of pages matching the query
     $q = $request->getParameter('q');
     if ($request->hasParameter('x')) {
         // We like to use input type="image" for presentation reasons, but it generates
         // ugly x and y parameters with click coordinates. Get rid of those and come back.
         return $this->redirect(sfContext::getInstance()->getController()->genUrl('a/search', true) . '?' . http_build_query(array("q" => $q)));
     }
     $key = strtolower(trim($q));
     $key = preg_replace('/\\s+/', ' ', $key);
     $replacements = sfConfig::get('app_a_search_refinements', array());
     if (isset($replacements[$key])) {
         $q = $replacements[$key];
     }
     $values = aZendSearch::searchLuceneWithValues(Doctrine::getTable('aPage'), $q, aTools::getUserCulture());
     $nvalues = array();
     foreach ($values as $value) {
         // doesn't implement isset
         if (strlen($value->info)) {
             $info = unserialize($value->info);
             if (!aPageTable::checkPrivilege('view', $info)) {
                 continue;
             }
         }
         $nvalue = $value;
         if (substr($nvalue->slug, 0, 1) === '@') {
             // Virtual page slug is a named Symfony route, it wants search results to go there
             $nvalue->url = $this->getController()->genUrl($nvalue->slug, true);
         } else {
             $slash = strpos($nvalue->slug, '/');
             if ($slash === false) {
                 // A virtual page (such as global) taht isn't the least bit interested in
                 // being part of search results
                 continue;
             }
             if ($slash > 0) {
                 // A virtual page slug which is a valid Symfony route, such as foo/bar?id=55
                 $nvalue->url = $this->getController()->genUrl($nvalue->slug, true);
             } else {
                 // A normal CMS page
                 $nvalue->url = aTools::urlForPage($nvalue->slug);
             }
         }
         $nvalue->class = 'aPage';
         $nvalues[] = $nvalue;
     }
     $values = $nvalues;
     if ($this->searchAddResults($values, $q)) {
         usort($values, "aActions::compareScores");
     }
     $this->pager = new aArrayPager(null, sfConfig::get('app_a_search_results_per_page', 10));
     $this->pager->setResultArray($values);
     $this->pager->setPage($request->getParameter('page', 1));
     $this->pager->init();
     $this->pagerUrl = "a/search?" . http_build_query(array("q" => $q));
     // setTitle takes care of escaping things
     $this->getResponse()->setTitle(aTools::getOptionI18n('title_prefix') . 'Search for ' . $q . aTools::getOptionI18n('title_suffix'));
     $this->results = $this->pager->getResults();
 }
开发者ID:quafzi,项目名称:timpany-prototype,代码行数:60,代码来源:BaseaActions.class.php

示例7: foreach

" class="a-nav a-nav-breadcrumb a-breadcrumb-<?php 
echo $name ? $name : 'component';
?>
 breadcrumb clearfix">
	<?php 
foreach ($nav as $pos => $item) {
    ?>
		<?php 
    if (!$item['archived'] || $draggable) {
        ?>
			<li class="<?php 
        echo $class;
        if ($item['slug'] == $active) {
            echo ' a-current-page';
        }
        ?>
"><?php 
        echo link_to($item['title'], aTools::urlForPage($item['slug']));
        if ($pos + 1 < count($nav)) {
            echo '<span class="a-breadcrumb-separator">' . $separator . '</span>';
        }
        ?>
			</li>
		<?php 
    }
    ?>
		
	<?php 
}
?>
</ul>
开发者ID:hashir,项目名称:UoA,代码行数:31,代码来源:_breadcrumb.php

示例8: getUrl

 public function getUrl($absolute = true)
 {
     return aTools::urlForPage($this->getSlug(), $absolute);
 }
开发者ID:verenate,项目名称:gri,代码行数:4,代码来源:PluginaPage.class.php

示例9: __

		    <li><a href="#" class="a-btn a-save big"><?php 
echo __('Save', array(), 'apostrophe_blog');
?>
</a></li>
		    <li><a href="#" class="a-btn a-cancel no-label big"><?php 
echo __('Cancel', array(), 'apostrophe_blog');
?>
</a></li>
		  </ul>				
		</div>		

		<div id="a-blog-item-permalink-interface">
			<h6>Permalink:</h6> 
			<div class="a-blog-item-permalink-wrapper url">
        <span><?php 
echo aTools::urlForPage($a_blog_post->findBestEngine()->getSlug()) . '/';
?>
</span><?php 
// Dan, Can you echo the REAL URL prefix here -- I don't know how to build a URL based on the complex blog route business we are doing
?>
			</div>
			<div class="a-blog-item-permalink-wrapper slug">
				<input type="text" name="a_blog_item_permalink_interface" value="<?php 
echo $a_blog_post->slug;
?>
" id="a_blog_item_permalink_interface">
			  <ul class="a-controls blog-slug">
			    <li><a href="#" class="a-btn a-save mini"><?php 
echo __('Save', array(), 'apostrophe_blog');
?>
</a></li>
开发者ID:quafzi,项目名称:timpany-prototype,代码行数:31,代码来源:editSuccess.php

示例10: executeSearch

 public function executeSearch(sfWebRequest $request)
 {
     // create the array of pages matching the query
     $q = $request->getParameter('q');
     if ($request->hasParameter('x')) {
         // We like to use input type="image" for presentation reasons, but it generates
         // ugly x and y parameters with click coordinates. Get rid of those and come back.
         return $this->redirect(sfContext::getInstance()->getController()->genUrl('a/search', true) . '?' . http_build_query(array("q" => $q)));
     }
     $key = strtolower(trim($q));
     $key = preg_replace('/\\s+/', ' ', $key);
     $replacements = sfConfig::get('app_a_search_refinements', array());
     if (isset($replacements[$key])) {
         $q = $replacements[$key];
     }
     $values = aZendSearch::searchLuceneWithValues(Doctrine::getTable('aPage'), $q, aTools::getUserCulture());
     $nvalues = array();
     foreach ($values as $value) {
         if (!sfContext::getInstance()->getUser()->isAuthenticated()) {
             if (isset($value->view_is_secure) && $value->view_is_secure) {
                 continue;
             }
         }
         $nvalue = $value;
         $nvalue->url = aTools::urlForPage($nvalue->slug, true);
         $nvalue->class = 'aPage';
         $nvalues[] = $nvalue;
     }
     $values = $nvalues;
     if ($this->searchAddResults($values, $q)) {
         usort($values, "aActions::compareScores");
     }
     $this->pager = new aArrayPager(null, sfConfig::get('app_a_search_results_per_page', 10));
     $this->pager->setResultArray($values);
     $this->pager->setPage($request->getParameter('page', 1));
     $this->pager->init();
     $this->pagerUrl = "a/search?" . http_build_query(array("q" => $q));
     // setTitle takes care of escaping things
     $this->getResponse()->setTitle(aTools::getOptionI18n('title_prefix') . 'Search for ' . $q);
     $this->results = $this->pager->getResults();
 }
开发者ID:verenate,项目名称:gri,代码行数:41,代码来源:BaseaActions.class.php

示例11: addPageToUrl

 /**
  * Prepends the current CMS page to the URL.
  *
  * @param  string $url The URL so far obtained from parent::generate
  * @param  Boolean $absolute  Whether to generate an absolute URL
  *
  * @return string The generated URL
  */
 public static function addPageToUrl(sfRoute $route, $url, $absolute)
 {
     $slug = aRouteTools::getContextEngineSlug($route);
     if (!$slug) {
         $defaults = $route->getDefaults();
         $page = aPageTable::getFirstEnginePage($defaults['module']);
         if (!$page) {
             $slug = null;
         } else {
             $slug = $page->slug;
         }
     }
     if (!$slug) {
         throw new sfException('Attempt to generate aRoute URL for module ' . $defaults['module'] . ' with no matching engine page on the site');
     }
     // A route URL of / for an engine route maps to the page itself, without a trailing /
     if ($url === '/') {
         $url = '';
     }
     // Ditto for / followed by a query string (missed this before)
     if (substr($url, 0, 2) === '/?') {
         $url = substr($url, 1);
     }
     $pageUrl = aTools::urlForPage($slug, $absolute);
     $rr = preg_quote(sfContext::getInstance()->getRequest()->getRelativeUrlRoot(), '/');
     // Strip controller off so it doesn't duplicate the controller in the
     // URL we just generated. Also strip off sf_relative_root if any.
     // We could use the slug directly, but that would
     // break if the CMS were not mounted at the root on a particular site.
     // Take care to function properly in the presence of an absolute URL
     if (preg_match("/^(?:https?:\\/\\/[^\\/]+)?{$rr}(?:\\/[^\\/]+\\.php)?(.*)\$/", $pageUrl, $matches)) {
         $pageUrl = $matches[1];
     }
     // Fix double / at beginning when engine is at root of site (think "just a blog")
     $finalUrl = $pageUrl . $url;
     $finalUrl = preg_replace('|^//|', '/', $finalUrl);
     return $finalUrl;
 }
开发者ID:hashir,项目名称:UoA,代码行数:46,代码来源:aRouteTools.php

示例12: __

		    <li><a href="#" class="a-btn a-save big"><?php 
echo __('Save', array(), 'apostrophe_blog');
?>
</a></li>
		    <li><a href="#" class="a-btn a-cancel no-label big"><?php 
echo __('Cancel', array(), 'apostrophe_blog');
?>
</a></li>
		  </ul>				
		</div>

		<div id="a-blog-item-permalink-interface">
			<h6>Permalink:</h6>
			<div class="a-blog-item-permalink-wrapper url">
        <span><?php 
echo aTools::urlForPage($a_event->findBestEngine()->getSlug()) . '/';
?>
</span>
			</div>
			<div class="a-blog-item-permalink-wrapper slug">
				<input type="text" name="a_blog_item_interface" value="<?php 
echo $a_event->slug;
?>
" id="a_blog_item_permalink_interface">
			  <ul class="a-controls blog-slug">
			    <li><a href="#" class="a-btn a-save mini"><?php 
echo __('Save', array(), 'apostrophe_blog');
?>
</a></li>
			    <li><a href="#" class="a-btn a-cancel no-label mini"><?php 
echo __('Cancel', array(), 'apostrophe_blog');
开发者ID:quafzi,项目名称:timpany-prototype,代码行数:31,代码来源:editSuccess.php

示例13: link_to

    $classes = '';
    if ($page) {
        if ($tab['level'] > 0) {
            if (aTools::pageIsDescendantOfInfo($page, $tab)) {
                $classes .= "a-current-page ";
            }
        }
        if ($page->slug === $tab['slug']) {
            $classes .= "a-current-page ";
        }
    }
    if ($tab['archived']) {
        $classes .= "a-archived-page ";
    }
    echo "class='{$classes} {$tabclass}'>";
    echo link_to($tab['title'], aTools::urlForPage($tab['slug']), array());
    echo "</li>\n";
    $tabcount++;
}
?>
</ul>
<?php 
if ($draggable) {
    ?>


	<script type="text/javascript">
	//<![CDATA[
	$(document).ready(
	  function() 
	  {
开发者ID:verenate,项目名称:gri,代码行数:31,代码来源:_tabs.php

示例14: include_partial

    if ($page->id === $pinfo['id']) {
        ?>
		<li class="a-breadcrumb-title current-page" id="a-breadcrumb-title-rename">
			<?php 
        include_partial('a/renamePage', array('page' => $page, 'edit' => $page->userHasPrivilege('edit')));
        ?>
		</li>
	<?php 
    } else {
        ?>
		<li class="a-breadcrumb-title" id="a-breadcrumb-title-<?php 
        echo $pinfo['id'];
        ?>
">
			<?php 
        echo link_to($title, aTools::urlForPage($pinfo['slug']));
        ?>
		</li>
	<?php 
    }
    ?>
	
  <?php 
    if ($page->id === $pinfo['id']) {
        ?>
    <?php 
        if ($page->userHasPrivilege('edit')) {
            ?>
  
		<li class="a-breadcrumb-page-settings" id="a-breadcrumb-page-settings">
      <?php 
开发者ID:verenate,项目名称:gri,代码行数:31,代码来源:_breadcrumb.php


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