逐浪CMS列表分页导航--大图标响应式列表分页v4修正内容

返回逐浪CMS技术讨论区
3回复贴,共1页,点击数:967

昨天晚上意外发现我上格筑家的分页http://www.3j99.cn那个大按钮不好用了。
在这里插入图片描述
打开列表分页导航—“大图标响应式列表分页v4”标签查看问题
我是用的txt打开的代码。具体如下:

<LabelContent>&lt;style&gt;
.pagination-lg .page-link {
    padding: 0.5rem 1.2rem;
}
.page-item.active .page-link {
    background-color: rgba(110,216,138,.9);
    border-color: rgba(110,216,138,1);
}
&lt;/style&gt;
&lt;div class="center-block text-center" id="pageDiv" totalPage="{totalpage/}" style="margin-top:2rem"&gt; 
&lt;nav aria-label="..." class="d-flex" style="justify-content: center;"&gt;
&lt;ul class="pagination pagination-lg" style="align-item:center;"&gt;
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{firsturl/}"&gt;&amp;laquo;&lt;/a&gt;&lt;/li&gt;
{loop range=\'4\'}
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{pageurl/}" id="bots{pageid/}"&gt;{pageid/}&lt;/a&gt;&lt;/li&gt;$$$
&lt;li class="page-item active" &gt;&lt;a  class="page-link" href="{currenturl/}"&gt;{currentpage/}&lt;/a&gt;&lt;/li&gt;{/loop} 
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{endurl/}"&gt;&amp;raquo;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/nav&gt;
&lt;div style="margin:auto;display:block;"&gt;
&lt;div class="input-group input-group-lg" style="max-width:15rem; justify-content:center; margin-bottom:2rem; margin-left:auto;margin-right:auto;"&gt;
&lt;span class="input-group-addon" style="max-width:7rem;"&gt;共{totalpage/}页 到&lt;/span&gt;
&lt;input style=" text-align: center;display:inline-block;" type="text" value="1" class="pages form-control" id="pages_t" size="1" style="width: auto; text-align: center;"&gt;
&lt;span class="input-group-btn"&gt;
&lt;button type="button" class="btn btn-success" onclick="pages()" &gt;&lt;i class="zi zi_handup"&gt;&lt;/i&gt;&lt;/button&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
 &lt;script&gt;
 function pages(){
 var a=document.getElementById("pages_t").value;
 document.getElementById("bots"+a).click();
 }
function pages(){  //动态分页下跳转
var a=document.getElementById("pages_t").value;
var firsturl='{firsturl/}';
var n1=firsturl.replace(/\.\w+$/,'').replace('1','').replace('_','');
var n2=/\.[^\.]+$/.exec(firsturl);
if(a&gt;{endpage/})
window.location.href='{endurl/}';
else
{
if(a==1)
window.location.href=n1+n2;
else
window.location.href=n1+"_"+a+n2;
}
}
&lt;/script&gt;</LabelContent>

找到JS部分

 &lt;script&gt;
 function pages(){
 var a=document.getElementById("pages_t").value;
 document.getElementById("bots"+a).click();
 }
function pages(){  //动态分页下跳转
var a=document.getElementById("pages_t").value;
var firsturl='{firsturl/}';
var n1=firsturl.replace(/\.\w+$/,'').replace('1','').replace('_','');
var n2=/\.[^\.]+$/.exec(firsturl);
if(a&gt;{endpage/})
window.location.href='{endurl/}';
else
{
if(a==1)
window.location.href=n1+n2;
else
window.location.href=n1+"_"+a+n2;
}
}
&lt;/script&gt;

逐浪CMSV8之后,<>都换为了>和>所以大家要看的懂
这个代码应该是MVC版转过来的,看这逻辑应该是
MVC是.aspx结尾,但V8是没有尾缀。所以上面的这个代码就不适用了。
n2会出现null的情况。所以应该先判断有没有尾缀,在V8中有尾缀的就是静态的,没有尾缀的就是动态的。加个判断改代码
废话不多说。上修正好的JS代码

<script>
 function pages(){
 var a=document.getElementById("pages_t").value;
 document.getElementById("bots"+a).click();
 }
function pages(){  //动态分页下跳转
var a=document.getElementById("pages_t").value;
var firsturl='index.shtml';
var n1=firsturl.replace(/\.\w+$/,'').replace('1','').replace('_','');
var n2=/\.[^\.]+$/.exec(firsturl);
console.log(n2)
if(n2 != null){
if(a>20){
window.location.href='index_20.shtml';
}else if(a==1){
window.location.href=n1+n2;;
}else{
console.log(n1+"_"+a)
window.location.href=n1+"_"+a+n2;;
}
}else{
if(a>20){
window.location.href='index_20.shtml';
}else if(a==1){
window.location.href=n1;
}else{
console.log(n1+"_"+a)
window.location.href=n1+"_"+a;
}
}

}
</script>

将<>转换一下

<LabelContent>&lt;style&gt;
.pagination-lg .page-link {
    padding: 0.5rem 1.2rem;
}
.page-item.active .page-link {
    background-color: rgba(110,216,138,.9);
    border-color: rgba(110,216,138,1);
}
&lt;/style&gt;
&lt;div class="center-block text-center" id="pageDiv" totalPage="{totalpage/}" style="margin-top:2rem"&gt; 
&lt;nav aria-label="..." class="d-flex" style="justify-content: center;"&gt;
&lt;ul class="pagination pagination-lg" style="align-item:center;"&gt;
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{firsturl/}"&gt;&amp;laquo;&lt;/a&gt;&lt;/li&gt;
{loop range=\'4\'}
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{pageurl/}" id="bots{pageid/}"&gt;{pageid/}&lt;/a&gt;&lt;/li&gt;$$$
&lt;li class="page-item active" &gt;&lt;a  class="page-link" href="{currenturl/}"&gt;{currentpage/}&lt;/a&gt;&lt;/li&gt;{/loop} 
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{endurl/}"&gt;&amp;raquo;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/nav&gt;
&lt;div style="margin:auto;display:block;"&gt;
&lt;div class="input-group input-group-lg" style="max-width:15rem; justify-content:center; margin-bottom:2rem; margin-left:auto;margin-right:auto;"&gt;
&lt;span class="input-group-addon" style="max-width:7rem;"&gt;共{totalpage/}页 到&lt;/span&gt;
&lt;input style=" text-align: center;display:inline-block;" type="text" value="1" class="pages form-control" id="pages_t" size="1" style="width: auto; text-align: center;"&gt;
&lt;span class="input-group-btn"&gt;
&lt;button type="button" class="btn btn-success" onclick="pages()" &gt;&lt;i class="zi zi_handup"&gt;&lt;/i&gt;&lt;/button&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
 &lt;script&gt;
 function pages(){
 var a=document.getElementById("pages_t").value;
 document.getElementById("bots"+a).click();
 }
function pages(){  //动态分页下跳转
var a=document.getElementById("pages_t").value;
var firsturl='{firsturl/}';
var n1=firsturl.replace(/\.\w+$/,'').replace('1','').replace('_','');
var n2=/\.[^\.]+$/.exec(firsturl);
if(a&gt;{endpage/})
window.location.href='{endurl/}';
else
{
if(a==1)
window.location.href=n1+n2;
else
window.location.href=n1+"_"+a+n2;
}
}
&lt;/script&gt;</LabelContent>

将上面的代码复制到txt打开的标签中位置即可

1楼 2021/03/30 10:45

太干,我居然一行也没看懂。
一会转义,一会不转义。。。

弄个附件不爽吗?

2楼 2021/03/30 11:17 收起回复

确实没懂..

<LabelContent>&lt;style&gt;
.pagination-lg .page-link {
    padding: 0.5rem 1.2rem;
}
.page-item.active .page-link {
    background-color: rgba(110,216,138,.9);
    border-color: rgba(110,216,138,1);
}
&lt;/style&gt;
&lt;div class="center-block text-center" id="pageDiv" totalPage="{totalpage/}" style="margin-top:2rem"&gt; 
&lt;nav aria-label="..." class="d-flex" style="justify-content: center;"&gt;
&lt;ul class="pagination pagination-lg" style="align-item:center;"&gt;
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{firsturl/}"&gt;&amp;laquo;&lt;/a&gt;&lt;/li&gt;
{loop range=\'4\'}
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{pageurl/}" id="bots{pageid/}"&gt;{pageid/}&lt;/a&gt;&lt;/li&gt;$$$
&lt;li class="page-item active" &gt;&lt;a  class="page-link" href="{currenturl/}"&gt;{currentpage/}&lt;/a&gt;&lt;/li&gt;{/loop} 
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{endurl/}"&gt;&amp;raquo;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/nav&gt;
&lt;div style="margin:auto;display:block;"&gt;
&lt;div class="input-group input-group-lg" style="max-width:15rem; justify-content:center; margin-bottom:2rem; margin-left:auto;margin-right:auto;"&gt;
&lt;span class="input-group-addon" style="max-width:7rem;"&gt;共{totalpage/}页 到&lt;/span&gt;
&lt;input style=" text-align: center;display:inline-block;" type="text" value="1" class="pages form-control" id="pages_t" size="1" style="width: auto; text-align: center;"&gt;
&lt;span class="input-group-btn"&gt;
&lt;button type="button" class="btn btn-success" onclick="pages()" &gt;&lt;i class="zi zi_handup"&gt;&lt;/i&gt;&lt;/button&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
 &lt;script&gt;
 function pages(){
 var a=document.getElementById("pages_t").value;
 document.getElementById("bots"+a).click();
 }
function pages(){  //动态分页下跳转
var a=document.getElementById("pages_t").value;
var firsturl='{firsturl/}';
var n1=firsturl.replace(/\.\w+$/,'').replace('1','').replace('_','');
var n2=/\.[^\.]+$/.exec(firsturl);
if(a&gt;{endpage/})
window.location.href='{endurl/}';
else
{
if(a==1)
window.location.href=n1+n2;
else
window.location.href=n1+"_"+a+n2;
}
}
&lt;/script&gt;</LabelContent>
3楼 2021/03/30 11:26 收起回复
上格筑家网:

标签中的<> 这两个都被转码了

2021/04/22 20:58 回复
<LabelContent>&lt;style&gt;
.pagination-lg .page-link {
    padding: 0.5rem 1.2rem;
}
.page-item.active .page-link {
    background-color: rgba(110,216,138,.9);
    border-color: rgba(110,216,138,1);
}
&lt;/style&gt;
&lt;div class="center-block text-center" id="pageDiv" totalPage="{totalpage/}" style="margin-top:2rem"&gt; 
&lt;nav aria-label="..." class="d-flex" style="justify-content: center;"&gt;
&lt;ul class="pagination pagination-lg" style="align-item:center;"&gt;
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{firsturl/}"&gt;&amp;laquo;&lt;/a&gt;&lt;/li&gt;
{loop range=\'4\'}
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{pageurl/}" id="bots{pageid/}"&gt;{pageid/}&lt;/a&gt;&lt;/li&gt;$$$
&lt;li class="page-item active" &gt;&lt;a  class="page-link" href="{currenturl/}"&gt;{currentpage/}&lt;/a&gt;&lt;/li&gt;{/loop} 
&lt;li class="page-item" &gt;&lt;a class="page-link" href="{endurl/}"&gt;&amp;raquo;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/nav&gt;
&lt;div style="margin:auto;display:block;"&gt;
&lt;div class="input-group input-group-lg" style="max-width:15rem; justify-content:center; margin-bottom:2rem; margin-left:auto;margin-right:auto;"&gt;
&lt;span class="input-group-addon" style="max-width:7rem;"&gt;共{totalpage/}页 到&lt;/span&gt;
&lt;input style=" text-align: center;display:inline-block;" type="text" value="1" class="pages form-control" id="pages_t" size="1" style="width: auto; text-align: center;"&gt;
&lt;span class="input-group-btn"&gt;
&lt;button type="button" class="btn btn-success" onclick="pages()" &gt;&lt;i class="zi zi_handup"&gt;&lt;/i&gt;&lt;/button&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
 &lt;script&gt;
 function pages(){
 var a=document.getElementById("pages_t").value;
 document.getElementById("bots"+a).click();
 }
function pages(){  //动态分页下跳转
var a=document.getElementById("pages_t").value;
var firsturl='{firsturl/}';
var n1=firsturl.replace(/\.\w+$/,'').replace('1','').replace('_','');
var n2=/\.[^\.]+$/.exec(firsturl);
if(a&gt;{endpage/})
window.location.href='{endurl/}';
else
{
if(a==1)
window.location.href=n1+n2;
else
window.location.href=n1+"_"+a+n2;
}
}
&lt;/script&gt;</LabelContent>
4楼 2021/06/22 16:42 收起回复
您未登录,没有发贴权限[点此登录]