Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Someone has a plugin or some code for custom pagging?

edited November 2008 in Vanilla 1.0 Help
I need help for custom pagging, but not could conclude, my code into now: mypagination.php << my extension idea for custom pagging <?php include('../../appg/settings.php'); include('../../appg/init_vanilla.php'); require($Configuration['LIBRARY_PATH'] . '/Framework/Framework.Class.PageList.php'); if($Context->SelfUrl == 'index.php'){ $Context->AddToDelegate('DiscussionGrid', 'Constructor', 'Pagin'); } function Pagin(&$DiscussionGrid) { $PageList = &$MyPagination->GetNumericList(); } class MyPagination extends PageList { function GetNumericList() { $PreviousText = '« Anterior'; $NextText = 'Próximo »'; $PreviousText .= ' '.$this->PreviousText; $NextText = ' '.$this->NextText.' '.$NextText; $this->DefineProperties(); $PageCount = $this->PageCount; $CurrentPage = $this->CurrentPage; $PageParameterName = $this->PageParameterName; $QSParams = $this->QueryStringParams->GetQueryString(); $iPagesToDisplay = $this->PagesToDisplay - 2; if ($iPagesToDisplay <= 8) $iPagesToDisplay = 8; $MidPoint = ($iPagesToDisplay / 2); $FirstPage = $CurrentPage - $MidPoint; if ($FirstPage < 1) $FirstPage = 1; $LastPage = $FirstPage + ($iPagesToDisplay - 1); if ($LastPage > $PageCount) { $LastPage = $PageCount; $FirstPage = $PageCount - $iPagesToDisplay; if ($FirstPage < 1) $FirstPage = 1; } $sReturn = '<div class="pagination"'; if (!empty($this->PageListID) && $this->PageListID != '') $sReturn .= ' id="'.$this->PageListID.'"'; $sReturn .= '>'; $Loop = 0; $iTmpPage = 0; $Url = GetUrl($this->Context->Configuration, $this->Context->SelfUrl,'', $this->UrlIdName, $this->UrlIdValue, '$$1', $QSParams, $this->UrlSuffix); if ($PageCount > 1) { if ($CurrentPage > 1) { $iTmpPage = $CurrentPage - 1; $sReturn .= ' <a class="prev_page" rel="prev" href="'.str_replace('$$1', $iTmpPage, $Url).'">'.$PreviousText.'</a>'; } else { $sReturn .= ' <span class="disabled prev_page" rel="prev">'.$PreviousText).'</span>'; } if ($CurrentPage > 1) { $iTmpPage = $CurrentPage - 1; $sReturn .= ' <a class="prev_page" rel="prev" href="'.str_replace('$$1', $iTmpPage, $Url).'">'.$PreviousText.'</a>'; } else { $sReturn .= ' <span class="disabled prev_page" rel="prev">'.$PreviousText).'</span>'; } if ($FirstPage > 2) { $sReturn .= ' <span class="start" href="'.str_replace('$$1',1, $Url).'"><</span> ... '; } elseif ($FirstPage == 2) { $sReturn .= ' <span class="start" href="'.str_replace('$$1',1, $Url).'"><</span>'; } $Loop = 0; for ($Loop = 1; $Loop <= $PageCount; $Loop++) { if (($Loop >= $FirstPage) && ($Loop <= $LastPage)) { if ($Loop == $CurrentPage) { $sReturn .= ' <span class="current">'.$Loop.'</span>'; } else { $sReturn .= ' <a'. iif($Loop == 1, ' rel="start"', '') .' href="'.str_replace('$$1', $Loop, $Url).'">'.$Loop.'</a>'; } } } if ($CurrentPage < ($PageCount - $MidPoint) && $PageCount > $this->PagesToDisplay - 1) { $sReturn .= '...<a href="'.str_replace('$$1', $PageCount, $Url).'">'.$PageCount.'</a>'; } else if ($CurrentPage == ($PageCount - $MidPoint) && ($PageCount > $this->PagesToDisplay)) { $sReturn .= '<a href="'.str_replace('$$1', $PageCount, $Url).'">'.$PageCount.'</a>'; } if ($CurrentPage != $PageCount) { $iTmpPage = $CurrentPage + 1; $sReturn .= '<a class="next_page" rel="next" href="'.str_replace('$$1', $iTmpPage, $Url).'">'.$NextText.'</a>'; } else { $sReturn .= ' <span class="disabled next_page" rel="prev">'.$NextText).'</span>'; } } else { $sReturn .= ' '; } $sReturn .= '</div>'; return $sReturn; } } $Context->ObjectFactory->SetReference('PageList', 'MyPagination'); ?>

Comments

  • Options
    I alter code to: function Pagin(&$DiscussionGrid) { $DiscussionGrid->Context->ObjectFactory->SetReference('PageList', 'MyPagination'); } and discussions.php '.$this->PageJump.$PageList.' and now is working! ;) thanks for nothing!
This discussion has been closed.