Bitrix Site Manager

CDBResult::NavPrint

CDBResult::NavPrint(
 string title,
 bool show_always=false,
 string text_css_class="text",
 string template_path=false
)

The method NavPrint is used to display the pagewise navigation links. You have to call the method NavStart prior to calling this function.

By default, the session stores the last opened page of the pagewise navigation pool. If you want to alter the default behavior, you can make the following call prior to calling the NavPrint method:

CPageOption::SetOptionString("main", "nav_page_in_session", "N");

Parameters

ParameterDescription
titleTitle of the displayed elements.
show_always If set to false, the method does not display navigation links if all records fit in a single page. If true, the links are always displayed. Optional; false by default.
text_css_class CSS class used to display the navigation links. Optional; "text" by default.
template_path Path to the template used to display the navigation links. Set to false to use the default template.

Return Values

No return value.

See Also

Example



<?
$rsEvents = CAdv::GetEventList($f_ID,($by="s_def"),($order="desc"), $arF, $is_filtered);
$rsEvents->NavPrint("Events", false, "tablebodytext", 
"/bitrix/modules/statistic/admin/adv_navprint.php");
?>

Sample navigation link templates


<?
echo('<font class="'.$StyleText.'">('.$title.' ');
echo(($this->NavPageNomer-1)*$this->NavPageSize+1);
echo(' - ');
if($this->NavPageNomer != $this->NavPageCount)
    echo($this->NavPageNomer * $this->NavPageSize);
else
    echo($this->NavRecordCount); 
echo(' '.GetMessage("nav_of").' ');
echo($this->NavRecordCount);
echo(")\n \n</font>");

echo('<font class="'.$StyleText.'">');

if ($this->NavPageNomer > 1)
    echo('<a class="tablebodylink" 
             href="'.$surlpath.'?pagen_'.$this->navnum.'=1'.
                   $strNavQueryString.'#nav_start'.
                   $add_anchor.'">'.$sBegin.'</a> |
          <a class="tablebodylink" 
             href="'.$surlpath.'?pagen_'.$this->navnum.'='.
                   ($this->NavPageNomer-1).$strNavQueryString.
                   '#nav_start'.$add_anchor.'">'.$sPrev.'</a>');
else
    echo($sBegin.' | '.$sPrev);

echo(' | '); 

$NavRecordGroup = $nStartPage;
while($NavRecordGroup <= $nEndPage)
{
    if($NavRecordGroup == $this->NavPageNomer) 
        echo('<b>'.$NavRecordGroup.'</b> '); 
    else
        echo('<a class="tablebodylink" 
                 href="'.$surlpath.'?pagen_'.$this->navnum.'='.
                       $NavRecordGroup.$strNavQueryString.'#nav_start'.
                       $add_anchor.'">'.$NavRecordGroup.'</a> ');
    $NavRecordGroup++;
}

echo('| ');
if($this->NavPageNomer < $this->NavPageCount)
    echo ('<a class="tablebodylink" 
              href="'.$surlpath.'?pagen_'.$this->navnum.'='.
                    ($this->NavPageNomer+1).$strNavQueryString.'#nav_start'.
                    $add_anchor.'">'.$sNext.'</a> |
           <a class="tablebodylink" 
              href="'.$surlpath.'?pagen_'.$this->navnum.'='.
                    $this->NavPageCount.$strNavQueryString.'#nav_start'.
                    $add_anchor.'">'.$sEnd.'</a> ');
else
    echo ($sNext.' | '.$sEnd.' ');

if($this->bShowAll)
    echo ($this->NavShowAll? '| <a class="tablebodylink" 
                                   href="'.$surlpath.'?showall_'.$this->navnum.'=0'.
                                         $strNavQueryString.'#nav_start'.
                                         $add_anchor.'">'.$sPaged.'</a> ' : '|
                                <a class="tablebodylink" 
                                   href="'.$surlpath.'?showall_'.$this->navnum.'=1'.
                                         $strNavQueryString.'#nav_start'.
                                         $add_anchor.'">'.$sAll.'</a> ');
echo('</font>');
?>