Commit 0903c20a authored by 神楽坂玲奈's avatar 神楽坂玲奈

翻页 初步

git-svn-id: http://glupx.googlecode.com/svn/trunk/Reliz@38 189f022a-1064-8ae2-3e6f-c4a67275c50b
parent cdc04ecf
#encoding: UTF-8
<div id="wrapper">
<div id="wrap" class="wrap s_clear">
<div class="main">
<div class="content">
......@@ -18,7 +19,8 @@
<div class="pages_btns s_clear">
<div class="pages"><strong>1</strong><a href="boarddisplay.php?fid=68&amp;page=2">2</a><a href="boarddisplay.php?fid=68&amp;page=3">3</a><a href="boarddisplay.php?fid=68&amp;page=4">4</a><a href="boarddisplay.php?fid=68&amp;page=2" class="next">下一页</a></div><span id="visitedboards" onmouseover="$('visitedboards').id = 'visitedboardstmp';this.id = 'visitedboards';showMenu({'ctrlid':this.id})" class="pageback"><a href="index.php">返回首页</a></span>
<%= render 'layouts/pages', :count => @board.topics.count %>
<span id="visitedboards" onmouseover="$('visitedboards').id = 'visitedboardstmp';this.id = 'visitedboards';showMenu({'ctrlid':this.id})" class="pageback"><a href="index.php">返回首页</a></span>
<span class="postbtn" id="newspecial" prompt="post_newthread" onmouseover="$('newspecial').id = 'newspecialtmp';this.id = 'newspecial';showMenu({'ctrlid':this.id})"><a href="post.php?action=newthread&amp;fid=68" onclick="showWindow('newthread', this.href);return false;">发帖</a></span>
</div>
......@@ -104,7 +106,7 @@
<%= link_to 'New Topic', new_topic_path %>
<%# fast newthread %>
<% form_tag :controller => :topics do %>
<%= form_tag :controller => :topics do %>
<p>
Title: <%= text_field_tag "topic[name]" %>
</p>
......@@ -139,4 +141,5 @@
<script>$('umenu').innerHTML = '<span id="myrepeats" onmouseover="showMenu(this.id)">[切换]</span>' + $('umenu').innerHTML;</script><ul id="myrepeats_menu" class="popupmenu_popup" style="display:none;"><li class="wide" style="clear:both"><a href="plugin.php?id=myrepeats:memcp">设置马甲</a></li></ul></div>
</div><ul class="popupmenu_popup headermenu_popup" id="plugin_menu" style="display: none"> <li><a id="mn_plugin_family_family" href="plugin.php?id=family:family">家族门派</a></li>
</ul>
<ul class="popupmenu_popup headermenu_popup" id="1nNcin_menu" style="display: none"><li><a href="plugin.php?id=moodwall" hidefocus="true" >心情墙壁</a></li><li><a href="plugin.php?id=dps_medalcenter" hidefocus="true" >勋章中心</a></li><li><a href="magic.php" hidefocus="true" >道具中心</a></li><li><a href="plugin.php?id=rs_sign:sign" hidefocus="true" >每日签到</a></li><li><a href="pet.php" hidefocus="true" >口袋东方</a></li><li><a href="plugin.php?id=promotion:promotion" hidefocus="true" >宣传中心</a></li><li><a href="bank.php" hidefocus="true" >社区银行</a></li><li><a href="plugin.php?id=family:family" hidefocus="true" >家族领地</a></li></ul><div id="footer">
<ul class="popupmenu_popup headermenu_popup" id="1nNcin_menu" style="display: none"><li><a href="plugin.php?id=moodwall" hidefocus="true" >心情墙壁</a></li><li><a href="plugin.php?id=dps_medalcenter" hidefocus="true" >勋章中心</a></li><li><a href="magic.php" hidefocus="true" >道具中心</a></li><li><a href="plugin.php?id=rs_sign:sign" hidefocus="true" >每日签到</a></li><li><a href="pet.php" hidefocus="true" >口袋东方</a></li><li><a href="plugin.php?id=promotion:promotion" hidefocus="true" >宣传中心</a></li><li><a href="bank.php" hidefocus="true" >社区银行</a></li><li><a href="plugin.php?id=family:family" hidefocus="true" >家族领地</a></li></ul>
</div>
\ No newline at end of file
<%#
# To change this template, choose Tools | Templates
# and open the template in the editor.
%>
<%#
function multi($count, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = TRUE, $simple = FALSE) {
global $maxpage;
$ajaxtarget = !empty($_GET['ajaxtarget']) ? " ajaxtarget=\"".dhtmlspecialchars($_GET['ajaxtarget'])."\" " : '';
$multipage = '';
$mpurl .= strpos($mpurl, '?') ? '&amp;' : '?';
$realpages = 1;
if($count > $perpage) {
$offset = 2;
$realpages = @ceil($count / $perpage);
$pages = $maxpages && $maxpages < $realpages ? $maxpages : $realpages;
if($page > $pages) {
$from = 1;
$to = $pages;
} else {
$from = $curpage - $offset;
$to = $from + $page - 1;
if($from < 1) {
$to = $curpage + 1 - $from;
$from = 1;
if($to - $from < $page) {
$to = $page;
}
} elseif($to > $pages) {
$from = $pages - $page + 1;
$to = $pages;
}
}
$multipage = ($curpage - $offset > 1 && $pages > $page ? '<a href="'.$mpurl.'page=1" class="first"'.$ajaxtarget.'>1 ...</a>' : '').
($curpage > 1 && !$simple ? '<a href="'.$mpurl.'page='.($curpage - 1).'" class="prev"'.$ajaxtarget.'>'.$lang['prev'].'</a>' : '');
for($i = $from; $i <= $to; $i++) {
$multipage .= $i == $curpage ? '<strong>'.$i.'</strong>' :
'<a href="'.$mpurl.'page='.$i.($ajaxtarget && $i == $pages && $autogoto ? '#' : '').'"'.$ajaxtarget.'>'.$i.'</a>';
}
$multipage .= ($to < $pages ? '<a href="'.$mpurl.'page='.$pages.'" class="last"'.$ajaxtarget.'>... '.$realpages.'</a>' : '').
($curpage < $pages && !$simple ? '<a href="'.$mpurl.'page='.($curpage + 1).'" class="next"'.$ajaxtarget.'>'.$lang['next'].'</a>' : '').
($showkbd && !$simple && $pages > $page && !$ajaxtarget ? '<kbd><input type="text" name="custompage" size="3" onkeydown="if(event.keyCode==13) {window.location=\''.$mpurl.'page=\'+this.value; return false;}" /></kbd>' : '');
$multipage = $multipage ? '<div class="pages">'.($showcount && !$simple ? '<em>&nbsp;'.$count.'&nbsp;</em>' : '').$multipage.'</div>' : '';
}
$maxpage = $realpages;
return $multipage;
}
%>
<% perpage = 3
curpage ||= (params[:page] || 1).to_i
if count > perpage
offset = 2;
pages = count / perpage
if 10 > pages
from = 1;
to = pages;
else
from = curpage - offset
to = from + page - 1;
if(from < 1)
to = curpage + 1 - from;
from = 1;
if(to - from < 10)
to = 10;
end
elsif(to > pages)
from = pages - page + 1;
to = pages
end
end
%>
<div class="pages">
<%= link_to_if curpage - offset > 1 && pages > 10, curpage, :page => 1, :class => :first %>
<%= link_to_if curpage > 1, t('forum.prev'), :page => curpage-1, :class => :prev %>
<% from.upto to do |i| %>
<%= link_to_if(i != curpage, i, :page => i){"<strong>#{i}</strong>".html_safe} %>
<% end %>
<%# p to, to < pages %><%#= to %><%#= (to<pages).inspect %>
<%= link_to_if(false, "...#{pages}", :page => pages, :class => :last) %>
<%= link_to_if(false, t('forum.next'), :page => curpage+1, :class => :next) %>
<!--
($showkbd && !$simple && $pages > $page && !$ajaxtarget ? '<kbd><input type="text" name="custompage" size="3" onkeydown="if(event.keyCode==13) {window.location=\''.$mpurl.'page=\'+this.value; return false;}" /></kbd>' : '');
-->
</div>
<% end %>
\ No newline at end of file
function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = TRUE, $simple = FALSE) {
global $maxpage;
$ajaxtarget = !empty($_GET['ajaxtarget']) ? " ajaxtarget=\"".dhtmlspecialchars($_GET['ajaxtarget'])."\" " : '';
if(defined('IN_ADMINCP')) {
$shownum = $showkbd = TRUE;
$lang['prev'] = '&lsaquo;&lsaquo;';
$lang['next'] = '&rsaquo;&rsaquo;';
} else {
$shownum = $showkbd = FALSE;
$lang['prev'] = '&nbsp';
$lang['next'] = $GLOBALS['dlang']['nextpage'];
}
$multipage = '';
$mpurl .= strpos($mpurl, '?') ? '&amp;' : '?';
$realpages = 1;
if($num > $perpage) {
$offset = 2;
$realpages = @ceil($num / $perpage);
$pages = $maxpages && $maxpages < $realpages ? $maxpages : $realpages;
if($page > $pages) {
$from = 1;
$to = $pages;
} else {
$from = $curpage - $offset;
$to = $from + $page - 1;
if($from < 1) {
$to = $curpage + 1 - $from;
$from = 1;
if($to - $from < $page) {
$to = $page;
}
} elseif($to > $pages) {
$from = $pages - $page + 1;
$to = $pages;
}
}
$multipage = ($curpage - $offset > 1 && $pages > $page ? '<a href="'.$mpurl.'page=1" class="first"'.$ajaxtarget.'>1 ...</a>' : '').
($curpage > 1 && !$simple ? '<a href="'.$mpurl.'page='.($curpage - 1).'" class="prev"'.$ajaxtarget.'>'.$lang['prev'].'</a>' : '');
for($i = $from; $i <= $to; $i++) {
$multipage .= $i == $curpage ? '<strong>'.$i.'</strong>' :
'<a href="'.$mpurl.'page='.$i.($ajaxtarget && $i == $pages && $autogoto ? '#' : '').'"'.$ajaxtarget.'>'.$i.'</a>';
}
$multipage .= ($to < $pages ? '<a href="'.$mpurl.'page='.$pages.'" class="last"'.$ajaxtarget.'>... '.$realpages.'</a>' : '').
($curpage < $pages && !$simple ? '<a href="'.$mpurl.'page='.($curpage + 1).'" class="next"'.$ajaxtarget.'>'.$lang['next'].'</a>' : '').
($showkbd && !$simple && $pages > $page && !$ajaxtarget ? '<kbd><input type="text" name="custompage" size="3" onkeydown="if(event.keyCode==13) {window.location=\''.$mpurl.'page=\'+this.value; return false;}" /></kbd>' : '');
$multipage = $multipage ? '<div class="pages">'.($shownum && !$simple ? '<em>&nbsp;'.$num.'&nbsp;</em>' : '').$multipage.'</div>' : '';
}
$maxpage = $realpages;
return $multipage;
}
......@@ -2,6 +2,9 @@
# by tsechingho (http://github.com/tsechingho)
zh-CN:
forum:
next: "下一页"
prev: "上一页"
stat:
onlineuser: "在线人数"
total: "总计"
......
This diff is collapsed.
6376
\ No newline at end of file
1100
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment