Documentation

NavPrint

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

The method is used to display links for pagewise navigation. Prior to calling this method, NavStart method must be called.

By default, the session stores the last opened page of the pagewise navigation pool. If you want to alter the default behavior for the current page, you must use the following code prior to calling the NavPrint method:

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

Non-static method.

Parameters

ParameterDescription Available from version
titleTitle of displayed elements.
show_always If "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.
StyleText CSS font class used to display navigation links.
Optional, "text" by default.
template_path Path to the template used to display the navigation links. If false, the default template is used.

See also

Examples of use

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

Examples of navigation links 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>');
?>


© «Bitrix24», 2001-2024
Up