本文整理汇总了PHP中ThemeUtil::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeUtil::getLink方法的具体用法?PHP ThemeUtil::getLink怎么用?PHP ThemeUtil::getLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThemeUtil
的用法示例。
在下文中一共展示了ThemeUtil::getLink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printNavigation
static function printNavigation($prevtext, $nexttext, $oneImagePage = false, $navlen = 7, $firstlast = true)
{
$total = getTotalPages($oneImagePage);
$current = getCurrentPage();
if ($total < 2) {
$class .= ' disabled_nav';
}
if ($navlen == 0) {
$navlen = $total;
}
$extralinks = 2;
if ($firstlast) {
$extralinks += 2;
}
$len = floor(($navlen - $extralinks) / 2);
$j = max(round($extralinks / 2), min($current - $len - (2 - round($extralinks / 2)), $total - $navlen + $extralinks - 1));
$ilim = min($total, max($navlen - round($extralinks / 2), $current + floor($len)));
$k1 = round(($j - 2) / 2) + 1;
$k2 = $total - round(($total - $ilim) / 2);
if ($firstlast) {
echo '<div class="nav-cell ' . ($current == 1 ? 'current' : 'first') . '">';
echo "<span class='valign'>";
printLink(getPageURL(1, $total), 1, "Page 1");
echo "</span></div>\n";
if ($j > 2) {
echo '<div class="nav-cell">';
echo "<span class='valign'>";
printLink(getPageURL($k1, $total), $j - 1 > 2 ? '...' : $k1, "Page {$k1}");
echo "</span></div>\n";
}
}
for ($i = $j; $i <= $ilim; $i++) {
echo '<div class="nav-cell' . ($i == $current ? " current" : "") . '">';
echo "<span class='valign'>";
printLink(getPageURL($i, $total), $i, "Page {$i}" . ($i == $current ? ' ' . gettext("(Current Page)") : ""));
echo "</span></div>\n";
}
if ($i < $total) {
echo '<div class="nav-cell">';
echo "<span class='valign'>";
printLink(getPageURL($k2, $total), $total - $i > 1 ? '...' : $k2, "Page {$k2}");
echo "</span></div>\n";
}
if ($firstlast && $i <= $total) {
echo '<div class="nav-cell last">';
echo "<span class='valign'>";
printLink(getPageURL($total, $total), $total, "Page {$total}");
echo "</span></div>\n";
}
$prevNextLinks = array();
$prevNextLinks['prev'] = ThemeUtil::getLink(getPrevPageURL(), $prevtext) . "\n";
$prevNextLinks['next'] = ThemeUtil::getLink(getNextPageURL(), $nexttext) . "\n";
return $prevNextLinks;
}