dedecms调用,代码如何贴?求详细。
二、在网站中放置
百度统计代码
位置;
1、模版型网站如:
a、织梦dedecms网站添加百度统计代码,
按理说你复制来的代码应该是有效的,看代码调用了一个javascript方法,是不是javascript文件没有加载完整?
这是我调用的方法:
HTML部分:
<div class="newdigg" id="newdigg"><div class="diggbox digg_good" onmousemove="thisstylebackgroundPosition='left bottom';" onmouseout="thisstylebackgroundPosition='left top';" onclick="javascript:postDigg('good',38)">
<div class="digg_act">顶一下</div>
<div class="digg_num">(0)</div>
<div class="digg_percent">
<div class="digg_percent_bar"><span style="width:0%"></span></div>
<div class="digg_percent_num">0%</div>
</div>
</div>
<div class="diggbox digg_bad" onmousemove="thisstylebackgroundPosition='right bottom';" onmouseout="thisstylebackgroundPosition='right top';" onclick="javascript:postDigg('bad',38)">
<div class="digg_act">踩一下</div>
<div class="digg_num">(0)</div>
<div class="digg_percent">
<div class="digg_percent_bar"><span style="width:0%"></span></div>
<div class="digg_percent_num">0%</div>
</div>
</div>
</div>
<script language="javascript">getDigg(38);</script>
JS部分:
function postDigg(ftype,aid){
var taget_obj = documentgetElementById('newdigg');
var saveid = GetCookie('diggid');
if(saveid != null)
{
var saveids = saveidsplit(',');
var hasid = false;
saveid = '';
j = 1;
for(i=saveidslength-1;i>=0;i--)
{
if(saveids[i]==aid && hasid) continue;
else {
if(saveids[i]==aid && !hasid) hasid = true;
saveid += (saveid=='' saveids[i] : ','+saveids[i]);
j++;
if(j==20 && hasid) break;
if(j==19 && !hasid) break;
}
}
if(hasid) { alert("您已经顶过该帖,请不要重复顶帖 !"); return; }
else saveid += ','+aid;
SetCookie('diggid',saveid,1);
}
else
{
SetCookie('diggid',aid,1);
}
myajax = new DedeAjax(taget_obj,false,false,'','','');
var url = "/plus/digg_ajaxphpaction="+ftype+"&id="+aid;
myajaxSendGet2(url);
DedeXHTTP = null;
}
function getDigg(aid)
{
var taget_obj = documentgetElementById('newdigg');
myajax = new DedeAjax(taget_obj,false,false,'','','');
myajaxSendGet2("/plus/digg_ajaxphpid="+aid);
DedeXHTTP = null;
}
确保加载了JS文件:
<script language="javascript" type="text/javascript" src="/include/dedeajax2js"></script>
找到dede默认的indexhtm文件的这段代码
<div class="picnews">
<dl class="tbox light">
<dt class='light'><strong>图文资讯</strong></dt>
<dd class='light'>
<div class="infiniteCarousel">
<div class="wrapper">
<ul id='imgscroll'>
{dede:arclist row=10 orderby=pubdate type='image' imgwidth='143' imgheight='106'}
<li><a href="[field:arcurl/]">[field:image/]<span class="title">[field:title/]</span></a></li>
{/dede:arclist}
</ul>
</div>
</div>
</dd>
</dl>
</div>
{dede:arclist row=10 orderby=pubdate type='image' imgwidth='143' imgheight='106'}
<li><a href="[field:arcurl/]">[field:image/]</a></li>
{/dede:arclist}这一段就是调用的代码了,如果还想要图文结合可以这样
{dede:arclist row=10 orderby=pubdate type='image' imgwidth='143' imgheight='106'}
<li><a href="[field:arcurl/]">[field:image/]<span class="title">[field:title/]</span></a></li>
{/dede:arclist}
file_exists()函数检查文件或者目录是否存在,dirname(__FILE__)当前文件所在目录名。主要是看/data/commonincphp是否存在。如果不存在就跳转到安装界面。
0条评论