本文整理汇总了PHP中buildNavigation函数的典型用法代码示例。如果您正苦于以下问题:PHP buildNavigation函数的具体用法?PHP buildNavigation怎么用?PHP buildNavigation使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了buildNavigation函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildNavigation
function buildNavigation($items, $parent = 0)
{
$hasChildren = false;
$childrenHtml = '';
$outputHtml = '<ul class="dropdown-menu">%s</ul>';
if ($parent == 0) {
$outputHtml = '%s';
}
foreach ($items as $item) {
if ($item['parent_id'] == $parent) {
$hasChildren = true;
$temp = buildNavigation($items, $item['id']);
$dropdown = $temp ? 'class="dropdown-submenu"' : '';
$childrenHtml .= '<li ' . $dropdown . '><a tabindex="-1" href="' . base_url('/administrator/category/' . $item['id']) . '">' . $item['title'] . '</a>';
$childrenHtml .= $temp;
$childrenHtml .= '</li>';
}
}
// Without children, we do not need the <ul> tag.
if (!$hasChildren) {
$outputHtml = '';
}
// Returns the HTML
return sprintf($outputHtml, $childrenHtml);
}
示例2: min
echo $startRow_rs_list + 1;
?>
to <?php
echo min($startRow_rs_list + $maxRows_rs_list, $totalRows_rs_list);
?>
of <?php
echo $totalRows_rs_list;
?>
</td>
<td class="text_body"><?php
# variable declaration
$prev_rs_list = "« previous";
$next_rs_list = "next »";
$separator = " | ";
$max_links = 10;
$pages_navigation_rs_list = buildNavigation($pageNum_rs_list, $totalPages_rs_list, $prev_rs_list, $next_rs_list, $separator, $max_links, true);
print $pages_navigation_rs_list[0];
?>
<?php
print $pages_navigation_rs_list[1];
?>
<?php
print $pages_navigation_rs_list[2];
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
示例3: buildNavigation
$sBox .= '<td width="90%" align="center">';
//в начале
if ($page <= 10) {
$sBox .= buildNavigation($page, 1, $pages > 10 ? $page + 4 : $pages, $sHref);
if ($pages > 15) {
$sBox .= '<span style="padding-right: 5px">...</span>';
//$sBox .= buildNavigation($page, $pages-5, $pages, $sHref);
}
} elseif ($page >= $pages - 10) {
$sBox .= buildNavigation($page, 1, 5, $sHref);
$sBox .= '<span style="padding-right: 5px">...</span>';
//$sBox .= buildNavigation($page, $page-5, $pages, $sHref);
} else {
$sBox .= buildNavigation($page, 1, 5, $sHref);
$sBox .= '<span style="padding-right: 5px">...</span>';
$sBox .= buildNavigation($page, $page - 4, $page + 4, $sHref);
$sBox .= '<span style="padding-right: 5px">...</span>';
//$sBox .= buildNavigation($page, $pages-5, $pages, $sHref);
}
$sBox .= '</td>';
if ($page == $pages) {
$sBox .= "<td><div id=\"nav_next_not_active\"><span>следующая</span></div></td>";
} else {
$sBox .= "<input type=\"hidden\" id=\"next_navigation_link\" value=\"" . ($sHref . ($page + 1)) . "\">";
$sBox .= "<td><div id=\"nav_next_not_active\"><a href=\"" . ($sHref . ($page + 1)) . "\" style=\"color: #717171\">следующая</a></div></td>";
}
$sBox .= '</tr>';
$sBox .= '</table>';
}
$sBox .= '</div>';
echo $sBox;
示例4: get_pager2
/**
* Строит пейджер (Постраничка одна из нескольких функций)
*
* @param integer $pages кол-во страниц
* @param integer $page текущая страница
* @param string $sHref ссылка для перехода по страницам. 'page=' должно быть в конце строки, туда будет подставлятся номер страницы
* @return string HTML код пейджера
*/
function get_pager2($pages, $page, $sHref)
{
/**
* Функция навигации, генерирует страницы с ссылками, а так же выделяет текущую страницу
*
* @param integer $iCurrent Текущая страница
* @param integer $iStart Стартовая позиция генерации списка страниц
* @param integer $iAll Конечная позиция генерации списка страниц
* @param string $sHref Ссылка ведущая на ту или иную страницу (шаблон ссылки, вконце подставляем page)
* @return string HTML-код
*/
function buildNavigation($iCurrent, $iStart, $iAll, $sHref)
{
$sNavigation = '';
for ($i = $iStart; $i <= $iAll; $i++) {
if ($i != $iCurrent) {
$sNavigation .= "<a href=\"" . $sHref . $i . "\" >" . $i . "</a>";
} else {
$sNavigation .= '<b style="margin-right: 5px">' . $i . '</b>';
}
}
return $sNavigation;
}
$maxpages = $pages;
$i = 1;
if ($pages > 32) {
$i = floor($page / 10) * 10 + 1;
if ($i >= 10 && $page % 10 < 5) {
$i = $i - 5;
}
$maxpages = $i + 22 - floor(log($page, 10) - 1) * 4;
if ($maxpages > $pages) {
$maxpages = $pages;
}
if ($maxpages - $i + floor(log($page, 10) - 1) * 4 < 22 && $maxpages - 22 > 0) {
$i = $maxpages - 24 + floor(log($page, 10) - 1) * 3;
}
}
$sBox = '<div id="fl2_paginator"><table width="100%"><tr>';
if ($page == 1 || $page > $pages) {
$sBox .= '<td><div id="nav_pre_not_active"><span>предыдущая</span></div></td>';
} else {
$sBox .= "<input type=\"hidden\" id=\"pre_navigation_link\" value=\"" . ($sHref . ($page - 1)) . "\" />";
$sBox .= "<td><div id=\"nav_pre_not_active\"><a href=\"" . ($sHref . ($page - 1)) . "\">предыдущая</a></div></td>";
}
$sBox .= '<td style="text-align: center; width:90%">';
//в начале
if ($page <= 10) {
$sBox .= buildNavigation($page, 1, $page + 4 > $pages ? $pages : $page + 4, $sHref);
if ($page + 4 < $pages) {
$sBox .= '<span style="padding-right: 5px">...</span>';
}
} elseif ($page >= $pages - 10) {
$sBox .= buildNavigation($page, 1, 5, $sHref);
$sBox .= '<span style="padding-right: 5px">...</span>';
$sBox .= buildNavigation($page, $page - 4, $pages, $sHref);
} else {
$sBox .= buildNavigation($page, 1, 5, $sHref);
$sBox .= '<span style="padding-right: 5px">...</span>';
$sBox .= buildNavigation($page, $page - 4, $page + 4 > $pages ? $pages : $page + 4, $sHref);
$sBox .= '<span style="padding-right: 5px">...</span>';
}
$sBox .= '</td>';
if ($page == $pages || $page > $pages) {
$sBox .= "<td><div id=\"nav_next_not_active\"><span>следующая</span></div></td>";
} else {
$sBox .= "<input type=\"hidden\" id=\"next_navigation_link\" value=\"" . ($sHref . ($page + 1)) . "\">";
$sBox .= "<td><div id=\"nav_next_not_active\"><a href=\"" . ($sHref . ($page + 1)) . "\" >следующая</a></div></td>";
}
$sBox .= '</tr>';
$sBox .= '</table></div>';
return $sBox;
}
示例5: array
}
/**
* Fills variables for navigation, header and footer
*/
if (AREA == 'admin' || AREA == 'customer') {
if (hasUpdates($version)) {
/*
* if froxlor-files have been updated
* but not yet configured by the admin
* we only show logout and the update-page
*/
$navigation_data = array('admin' => array('index' => array('url' => 'admin_index.php', 'label' => $lng['admin']['overview'], 'elements' => array(array('label' => $lng['menue']['main']['username']), array('url' => 'admin_index.php?action=logout', 'label' => $lng['login']['logout']))), 'server' => array('label' => $lng['admin']['server'], 'required_resources' => 'change_serversettings', 'elements' => array(array('url' => 'admin_updates.php?page=overview', 'label' => $lng['update']['update'], 'required_resources' => 'change_serversettings')))));
$navigation = buildNavigation($navigation_data['admin'], $userinfo);
} else {
$navigation_data = loadConfigArrayDir('lib/navigation/');
$navigation = buildNavigation($navigation_data[AREA], $userinfo);
}
unset($navigation_data);
}
/**
* header information about open tickets (only if used)
*/
$awaitingtickets = 0;
$awaitingtickets_text = '';
if (Settings::Get('ticket.enabled') == '1') {
$opentickets = 0;
if (AREA == 'admin' && isset($userinfo['adminid'])) {
$opentickets_stmt = Database::prepare("\n\t\t\tSELECT COUNT(`id`) as `count` FROM `" . TABLE_PANEL_TICKETS . "`\n\t\t\tWHERE `answerto` = '0' AND (`status` = '0' OR `status` = '1')\n\t\t\tAND `lastreplier` = '0' AND `adminid` = :adminid\n\t\t");
$opentickets = Database::pexecute_first($opentickets_stmt, array('adminid' => $userinfo['adminid']));
$awaitingtickets = $opentickets['count'];
if ($opentickets > 0) {
示例6: buildNavigation
function buildNavigation($items, $currentId = 0, $parent = 0)
{
$hasChildren = false;
$childrenHtml = '';
$outputHtml = '<ul class="c-dropdown-menu">%s</ul>';
if ($parent == 0) {
$outputHtml = '%s';
}
foreach ($items as $item) {
$s = $item['id'] == $currentId ? 'selected' : '';
if ($item['parent_id'] == $parent) {
$hasChildren = true;
$temp = buildNavigation($items, $currentId, $item['id']);
$dropdown = $temp ? 'class="c-dropdown-submenu"' : '';
$childrenHtml .= '<li ' . $dropdown . '><a class="' . $s . '" tabindex="-1" href="' . base_url('p/cat/' . $item['slug'] . '-' . $item['id']) . '.html">' . $item['title'] . '</a>';
$childrenHtml .= $temp;
$childrenHtml .= '</li>';
}
}
// Without children, we do not need the <ul> tag.
if (!$hasChildren) {
$outputHtml = '';
}
// Returns the HTML
return sprintf($outputHtml, $childrenHtml);
}