织梦读取数据库几个用法
如遇下载链接蓝奏网盘打不开lanzous替换成lanzoux尝试! 广告
调取ID为16 标题长度为40 简介长度为50 降序desc(升序asc)的领先条( 第2到5条为limit=’1,4’ )
{dede:arclist typeid=’16’ titlelen=’40’ infolen=’50’ orderway=’desc’ limit=’0,1′ }
<img src=”[field:picname/]” width=”158″ height=”119″>
<a href=”[field:arcurl /]” title=”[field:fulltitle /]” >[field:title /]</a>
<dd>[field:description function=”cn_substr(Html2text(@me),180)”/]…</dd>
{/dede:arclist}
ID15 20条 简介50 标题10
{dede:arclist row=”20″ typeid=”15″ titlelen=”10″ infolen=”50″}
<li><a href=”[field:typeurl/]” title=”[field:fulltitle/]” >[[field:typename/]]</a><a href=”[field:arcurl /]”>[field:title /]</a></li>
{/dede:arclist}
自动获取页面提交的时间
<input name=”hzlytime” type=”text” class=”bor” />
<script language=”javascript” type=”text/javascript”>
var c=new Date().toLocaleString();
document.write(“<input type=’hidden’ name=’hzlytime’ id=’hzlytime’ value= ‘”+c+”‘/>”);
</script>
列表ID等于1加特别css style=display:block
{dede:arclist row=6 typeid=’20’ titlelen=’80’ orderway=’desc’ addfields=’sydt’ channelid=’1′ }
<div class=”sci2contL” id=”con_zj_[field:global.autoindex/]” [field:global name=autoindex runphp=”yes”](@me==1)? @me=”style=display:block”:@me=””;[/field:global]><a href=”#”><img src=”[field:sydt/]” width=”610″ height=”360″></a></div>
{/dede:arclist}
调取某条ID为156新闻的自定义字段
{dede:arclist typeid=’49’ idlist=’156′ addfields=’trueprice,brand,yfty,yfwy,yftr,yfwe,yfts,yfws,yftss,yfwss,yftw,yfww,yftl,yfwl’ channelid=’6′ }
[field:yfwy/]
{/dede:arclist}
根据页面ID 显示不同的内容
<div {dede:field name=’typeid’ runphp=’yes’} if(@me==24) @me=’style=display:block’; else @me=’style=display:none’; {/dede:field} >
typeid为24显示
</div>
<div {dede:field name=’typeid’ runphp=’yes’} if(@me==39) @me=’style=display:block’; else @me=’style=display:none’; {/dede:field} >
typeid为39显示
</div>
根据浏览器地址对应导航显示不同css样式(GetNavigationk)
<div >
<ul>
<li id=”kNav1″><a href=”/”>网站首页</a></li>
<li id=”kNav2″><a href=”html/abouts”>关于我们</a></li>
<li id=”kNav3″><a href=”html/news”>新闻资讯</a></li>
<li id=”kNav4″><a href=”html/case”>服务产品</a></li>
</ul>
</div>
<script type=”text/javascript”>
//导行样式指定
function GetNavigationk(kUrlStr){
var kNavUrl = window.location.href;
if(kNavUrl.indexOf(“ttttttttttttt”)!=-1){var ControlNumk = 1;}
else if(kNavUrl.indexOf(“html/abouts”)!=-1){var ControlNumk = 2;}
else if(kNavUrl.indexOf(“html/news”)!=-1){var ControlNumk = 3;}
else if(kNavUrl.indexOf(“html/case”)!=-1){var ControlNumk = 4;}
else {var ControlNumk = 1;}
return ControlNumk;
}
var ControlIDk = “kNav”+GetNavigationk(window.location.href);
document.getElementById(ControlIDk).className=”style_1″;
</script>
根据浏览器地址对应导航显示不同css样式(GetNavigation)
<div id=”PARENT”>
<ul id=”nav”>
<li id=”Nav1″><a href=”/html/news/major/”>集团要闻</a></li>
<li id=”Nav2″><a href=”/html/news/brief/”>集团简讯</a></li>
<li id=”Nav3″><a href=”/html/news/media/”>媒体报道</a></li>
<li id=”Nav4″><a href=”/html/news/calling/”>业内动态</a></li>
<li id=”Nav5″><a href=”/html/news/notice/”>公示公告</a></li>
<li id=”Nav6″><a href=”/html/news/special/”>专题报道</a></li>
</ul>
</div>
<script language=”javascript”>
//导行样式指定
function GetNavigation(UrlStr){
var NavUrl = window.location.href;
if(NavUrl.indexOf(“news/major”)!=-1){var ControlNum = 1;}
else if(NavUrl.indexOf(“news/brief”)!=-1){var ControlNum = 2;}
else if(NavUrl.indexOf(“news/media”)!=-1){var ControlNum = 3;}
else if(NavUrl.indexOf(“news/calling”)!=-1){var ControlNum = 4;}
else if(NavUrl.indexOf(“news/notice”)!=-1){var ControlNum = 5;}
else if(NavUrl.indexOf(“news/special”)!=-1){var ControlNum = 6;}
else {var ControlNum = 0;}
return ControlNum;
}
window.onload = function(){
var ControlID = “Nav”+GetNavigation(window.location.href);
document.getElementById(ControlID).className=”style_2″;
}
</script>
根据浏览器地址打印不同的文字
<script type=”text/javascript”>
//命名规则
function GetNavigationk(CUrlStr){
var CNavUrl = window.location.href;
if(CNavUrl.indexOf(“news/major”)!=-1){document.write(“集团简讯”);}
else if(CNavUrl.indexOf(“news/brief”)!=-1){document.write(“集团要闻”);}
else if(CNavUrl.indexOf(“news/media”)!=-1){document.write(“媒体报道”);}
else if(CNavUrl.indexOf(“news/calling”)!=-1){document.write(“业内动态”);}
else if(CNavUrl.indexOf(“news/notice”)!=-1){document.write(“公示公告”);}
else if(CNavUrl.indexOf(“news/special”)!=-1){document.write(“专题报道”);}
else {document.write(“资讯中心”);}
return ControlNumk;
}
{
var ControlIDk = “pNav”+GetNavigationk(window.location.href);
}
</script>
网站导航当前栏目显示class=’navhover’
<a href=”{dede:global.cfg_basehost/}” title=”{dede:global.cfg_webname/}” {dede:field name=typeid runphp=”yes”}(@me==””)? @me=” class=’navhover'”:@me=””;{/dede:field}>网站首页</a>
{dede:channel type=’top’ row=’8′ currentstyle=”<a href=’~typelink~’ class=’navhover’ >~typename~</a>”}
<a href='[field:typeurl/]’>[field:typename/]</a>
{/dede:channel}
NOTICE:【咨询风格酷】客服微信:wwwxmamnet
NOTICE:【风格酷模板网②群】QQ群:288678775
☉免责声明:本站所有模板均来自用户分享和网络收集,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服,我们核实后会立即删除。
☉如果源码网盘地址失效!或有其他问题,请点我报错,谢谢合作!
☉人民币与积分汇率为1比10,即1元=10积分.有任何疑问请联系客服!
☉如有其他问题,请加网站客服QQ(1131734965)进行交流。
☉本站提供的源码、模板、软件工具等其他资源,都不包含技术服务,请大家谅解!
☉源码、模板等资源会随着技术、环境的升级而存在部分问题,还请慎重选择。