ackcms 标签语法

分类:其它系统

 列表页,列表与分页代码

            	<ul class="news_list" >
                    <{getcategories id=$category  template="<#getitems(#)num=1000(#)category=[%categoryid](#)orderby=time_reverse(#)template=<li><div class='tit' ><a href='[url]' title='[title]' >[title]</a></div><div class='time' >[y]/[m]/[d]</div></li>#>"}>
                </ul>
                 <div class="NewsPages">
                    <div>
                        <a title="转到首页" style="margin-right:5px; cursor:pointer" id="first" >[首页]</a>
                        <a title="转到上一页" style="margin-right:5px; cursor:pointer" id="last" >[上一页]</a>
                        <span id="page"></span>
                        <a title="转到下一页" style="margin-right:5px; cursor:pointer" id="next" >[下一页]</a>
                        <a title="转到尾页" style="margin-right:5px; cursor:pointer" id="end" >[尾页]</a>
                    </div>
                </div>
            </div>
        </div>
        <{include file=footer.htm}>
    </div>
<script type="text/ecmascript">
$(function(){
	var NEWS_PER_PAGE = 10;
	var count_entry = $('.news_list li').length;
	var count_page = parseInt(Math.ceil(count_entry / NEWS_PER_PAGE));

	var curPage = 0;
	var getPageIndex = function(){return curPage + 1;};
	
	function showPage(){
		$('.news_list li').hide();
		$('.news_list li').each(function(index, item){
			if(index >= curPage * NEWS_PER_PAGE &&
					index < (curPage + 1) * NEWS_PER_PAGE){
				$(item).show();
			}
		});
	}	
	showPage();
	
	function showPage_num(){
		var str = '';
		if(count_page <= 5){
			for(i=1;i<=count_page;i++){
				str = str + '<a href="javascript:void(0);" id="'+i+'" >'+i+'</a>'
			}
		}
		else{
			if(curPage < 5){
				for(i=1;i<=5;i++){
					str = str + '<a href="javascript:void(0);" id="'+i+'" >'+i+'</a>'
				}
				str = str + "…";
				str = str + '<a href="javascript:void(0);" id="'+count_page+'" >'+count_page+'</a>';
			}
			else if( curPage < count_page - 3  && curPage >=  5 ){
				str = str + '<a href="javascript:void(0);" id="1" >1</a>';
				str = str + "…";
				for(i=2;i>=1;i--){
					str = str + '<a href="javascript:void(0);" id="'+(curPage-i)+'" >'+(curPage-i)+'</a>';
				}
				str = str + '<a href="javascript:void(0);" id="'+curPage+'" >'+curPage+'</a>';
				for(i=1;i<=2;i++){
					str = str + '<a href="javascript:void(0);" id="'+(curPage+i)+'" >'+(curPage+i)+'</a>'
				}
				str = str + "…";
				str = str + '<a href="" id="'+count_page+'" >'+count_page+'</a>';
			}
			else if( curPage>3 && curPage >= count_page - 5 ){
				str = str + '<a href="javascript:void(0);" id="1" >1</a>';
				str = str + "…";
				for(i=4;i>=0;i--){
					str = str + '<a href="javascript:void(0);" id="'+(count_page-i)+'" >'+(count_page-i)+'</a>';
				}
			}
		}
		$("#page").html(str);
		$('#page a').each(function(index, item){
			if($(this).attr("id") == curPage+1 ){
				$(this).css({"text-decoration":"underline","color":"#000"});
			}
		});
	}
	showPage_num();
	
	$("#first").click(function(){ curPage = 0; showPage(); showPage_num(); });
	$("#end").click(function(){ curPage = count_page-1; showPage(); showPage_num(); });
	$("#last").click(function(){
		if(curPage-1 >= 0){
			curPage--;
			showPage(); 
			showPage_num();
		}
		else{
			alert("已经是第一页了!")
		}
	});
	$("#next").click(function(){
		if(curPage+1 < count_page){
			curPage++;
			showPage(); 
			showPage_num();
		}
		else{
			alert("已经是最后一页了!")
		}
	});
         $("#page a").live("click",function(){
	   curPage = parseInt($(this).attr("id"))-1;
	   showPage();
	   showPage_num();
	});
});
</script>

首页调用主题:

1.是外链的

 

 <{getitems category="62" orderby="time_reverse" num="10"  template='<li><a href="[data]" title="[title]" target="_blank" >[title]</a></li>'}>

2,是内链的

<{getitems category="55" orderby="time_reverse" num="10"  template='<li><a href="[url]" title="[title]">[title]</a></li>'}>

 

 

seo优化送    jquery处理内容长度代码

//新闻报道

$(".new_content a").each(function() { 

       if($(this).html().length > 25){

  var text = $(this).html();

  $(this).html(text.substr(0,25)+"……");

 }

 

    });

 

本文链接: ackcms 标签语法
版权所有:布士收藏夹在网络收集,如有侵犯你的权利, 请联系QQ:641868752。

评论

发表评论

*

* (显示gravatar头像)

Ctrl+Enter快捷回复

© 2014 布士收藏夹 all rights reserved.