To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Show
Ignore:
Timestamp:
04/26/10 17:08:58 (2 years ago)
Author:
tboutell
Message:

New default behavior of navigation components is appropriate for use on large sites with many pages. On small sites it may be slightly slower, in which case you can set app_a_many_pages to false to get the old "fetch the entire page tree and reuse it in each navigation component as needed" behavior back. This worked quite well up to about 1,000 pages but became a serious problem on an 8,000-page site.

aPage::getAncestorsInfo now has an optional 'includeSelf' parameter which defaults to false for backwards compatibility.

aPage::getInfo provides a page info array about the current page. Useful when merging information from the Info methods with information about pages you already have as objects.

aPage::getAccordionInfo now has an optional final parameter, 'root', which specifies the slug of the root page of the accordion tree. The page on which getAccordionInfo is called should be a descendant of that page (or the root page itself).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostrophePlugin/trunk/lib/navigation/aNavigationBreadcrumb.class.php

    r806 r1065  
    44{ 
    55  protected $cssClass = 'a-nav-item';  
     6  public function initializeTree() 
     7  { 
     8    if (sfConfig::get('app_a_many_pages', true)) 
     9    { 
     10      // The use of the static sitewide page tree  
     11      // requires too much memory on sites with more 
     12      // than about 500-1000 pages. On smaller sites 
     13      // it turns out to be a performance win to get 
     14      // all of the page information for the site and 
     15      // cache it for subsequent navigation elements on 
     16      // the same page, which the base class does for us 
     17    } 
     18    else 
     19    { 
     20      parent::initializeTree(); 
     21    } 
     22  } 
     23   
    624  public function buildNavigation() 
    725  { 
     26    if (sfConfig::get('app_a_many_pages', true)) 
     27    { 
     28      $activePage = aPageTable::retrieveBySlug($this->active); 
     29      // true = include the page itself 
     30      $this->nav = $activePage->getAncestorsInfo(true); 
     31      $i = count($this->nav); 
     32      $info = &$this->nav[$i - 1]; 
     33      if (!isset($info['class'])) 
     34      { 
     35        $info['class'] = ''; 
     36      } 
     37      $info['class'] .= ' a-current-page'; 
     38      return; 
     39    } 
    840    $this->rootInfo = parent::$hash[$this->root]; 
    941    $this->activeInfo = parent::$hash[$this->active];