主题相关

2021-2-13
Emlog读者墙美化代码

Emlog读者墙美化代码

一、操作步骤1、打开模板文件module.php,添加如下代码 <?php function guest($num){ global $CACHE; $user_cache = $CACHE->readCache('user'); $name = $user_cache[1]['name']; $DB = Database::getInstance(); $sql = "SELECT count(*) AS comment_nums,poster,mail,url FROM ".DB_PREFIX."comment where date >0 and poster !='". $name ."' and poster !='' and hide ='n' group by poster order by comment_nums DESC limit 0,$num"; $log_content = $content[1]; if(strpos($log_content, '[READERWALL-WEEK]') > -1) { $cur_time_span = strtotime('last Year',strtotime('Sunday')); } $result = $DB -> query( $sql ); while($row = $DB -> fetch_array($result)){ $img = "<li><a rel=\"external nofollow\" target=\"_blank\" href=\"" . $row[ 'url' ] . "\" title=\"" . $row[ 'poster' ] ."(赐教" . $row[ 'comment_nums' ] . "次)\"><img alt=\"avatar\" src=\"" . getGravatar($row['mail']) . "\" class=\"avatar\"><em>" . $row[ 'poster' ] ."</em><strong>+" . $row[ 'comment_nums' ] . "</strong></a></li>"; if( $row[ 'url' ] ){ $tmp = "<li><a rel=\"external nofollow\" target=\"_blank\" href=\"" . $row[ 'url' ] . "\" title=\"" . $row[ 'poster' ] ."\" ><img alt=\"avatar\" src=\"" . getGravatar($row['mail']) . "\"><em>" . $row[ 'poster' ] ."</em><strong>+" . $row[ 'comment_nums' ] . "</strong></a></li>"; }else{ $tmp = $img; } $output .= $tmp; } $output = ''. $output .''; return $output ;}?> 2、打开模板样式文件style.css,添加如下代码 ul.readers-list{overflow:hidden;margin:0 auto;padding:0;}ul.readers-list li{display:inline-block;width:20%;}ul.readers-list a{position:relative;display:block;overflow:hidden;margin:0 4px;padding:4px 4px 4px 44px;height:40px;border:1px solid #eaeaea;color:#999;text-decoration:none;line-height:32px;}ul.readers-list img{float:left;margin:0 8px 0 -38px;width:30px;height:30px;border:3px #fff solid;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(34,25,25,.5);}ul.readers-list em{position:absolute;overflow:hidden;margin-right:10px;width:50%;height:36px;color:#000;text-overflow:ellipsis;white-space:nowrap;font-style:normal;transition:all .2s ease-out;}ul.readers-list strong{position:absolute;right:8px;width:20%;color:#999;text-align:right;} 3、在侧边栏或单页面上添加如下引用代码即可 <ul class="readers-list"><?php echo guest(100); ?></ul> 二、原理解析在模板核心文件中添加读者墙功能代码,通过CSS对其进行美化,然后输出即可三、注意事项1、本教程中的引用代码推荐添加在单页面上...
主题相关 1096次浏览0条评论
2021-2-6
emlog文章页添加已阅读时间

emlog文章页添加已阅读时间

将代码添加至模板文件echo_log.php适当位置(建议添加在正文结束后面)css: #tingliu{margin: 30px 0px 15px 0px; padding: 5px 0px 10px 0px; height: 100%; line-height: 2; text-align:center; font-size:14px; background: #f8f8f8; border: 1px dashed #CEB8A3; transition:all 0.2s ease-in-out 0s; -moz-transition:all 0.2s ease-in-out 0s;-webkit-transition:all 0.2s ease-in-out 0s;} #tingliu:hover{background: #F4F1EF; border: 1px dashed #D9007C; border-radius:0px; -webkit-border-radius:0px; -moz-border-radius:0px;} .tingliu2{color:#7C4500;} .tingliu3{color: #C03131;} .tingliu4{position:relative; left:0px; top:3px;} .tingliu5{position:relative; left:0px; top:5px;}代码: <!--统计文章阅读时间开始--> <div id="tingliu"><span class="tingliu2 hint--top hint--bounce" data-hint="希望这篇文章能给你带来收获,去发表评论吧!?"> <img src="http://ww4.sinaimg.cn/large/0060lm7Tgw1f8qy1bokcrg300q00oq2r.gif" class="tingliu5"></span> &nbsp; <span class="tingliu2">您阅读这篇文章共花了:</span>&nbsp; <span class="tingliu3" id="stime"></span></div> <script language="JavaScript">var ss=0,mm=0,hh=0;function TimeGo(){ss++;if(ss>=60){mm+=1;ss=0}if(mm>=60){hh+=1;mm=0}ss_str=(ss<10?"0"+ss:ss);mm_str=(mm<10?"0"+mm:mm);tMsg=""+hh+"小时"+mm_str+"分"+ss_str+"秒";document.getElementById("stime").innerHTML=tMsg;setTimeout("TimeGo()",1000)}TimeGo();</script> <!--统计文章阅读时间结束--> ...
2021-2-5
Emlog模版文章页标题自动变颜色方法

Emlog模版文章页标题自动变颜色方法

1、打开模板下的 css 文件 ,把下面颜色代码添加进去,里面颜色自己修改,众口难调每个人喜好的颜色都不一样.... #bianse{animation:change 10s linear 0s infinite;} @keyframes change{0%{color:#333;}25%{color:#fff0;}50%{color:#f60;}75%{color:#cf0;}100%{color:#f00;}}2、打开模板下的 文章页文件 echo_log.php 找到 <?php echo $log_title; ?> 如果模版没有改过就是被 h2 标签嵌套的,只需要在 h2 标签里面调用 id="bianse" 即可。 <h2 class="post-title" id="bianse">这里是标题内容</h2>...
主题相关 1101次浏览0条评论
2021-2-2
Emlog非插件实现3D标签云

Emlog非插件实现3D标签云

1.module找到你的侧边栏标签 修改侧边栏标签如下 <?php //3D标签云 function widget_tag($title){ global $CACHE; $tag_cache = $CACHE->readCache('tags');?> <div class="side"> <h3><i class="fa fa-tags mar-r-4"></i><?php echo $title;?></h3> <div id="tag_cloud_widget"> <div class="tagcloud"> <script type="text/javascript" src="<?php echo TEMPLATE_URL; ?>js/3dtag.js"></script> <?php foreach($tag_cache as $value): ?> <a href="<?php echo Url::tag($value['tagurl']); ?>" title="<?php echo $value['usenum']; ?> 篇文章"><?php echo $value['tagname']; ?></a> <?php endforeach; ?> <div class="clear"></div></div></div></div> <?php }?>2.你的公用模板css放如下css /*3D标签云*/ #tag_cloud_widget{position:relative;width:240px;height:240px;margin:10px auto 10px} #tag_cloud_widget a{position:absolute;color:#fff;text-align:center;text-overflow:ellipsis;white-space:nowrap;top:0;left:0;padding:3px 5px;border:0} #tag_cloud_widget a:hover{background:#d02f53;display:block} #tag_cloud_widget a:nth-child(n){background:#666;border-radius:3px;display:inline-block;line-height:18px;margin:0 10px 15px 0} #tag_cloud_widget a:nth-child(2n){background:#d1a601} #tag_cloud_widget a:nth-child(3n){background:#286c4a} #tag_cloud_widget a:nth-child(5n){background:#518ab2} #tag_cloud_widget a:nth-child(4n){background:#c91d13}3.保存下面js为3dtag.js 放到你的模板js目录里面 var radius = 100; var d = 200; var dtr = Math.PI / 180; var mcList = []; var lasta = 1; var lastb = 1; var distr = true; var tspeed = 11; var size = 200; var mouseX = 0; var mouseY = 10; var howElliptical = 1; var aA = null; var oDiv = null; window.onload = function() { var i = 0; var oTag = null; oDiv = document.getElementById('tag_cloud_widget'); aA = oDiv.getElementsByTagName('a'); for (i = 0; i < aA.length; i++) { oTag = {}; aA[i].onmouseover = (function(obj) { return function() { obj.on = true; this.style.zIndex = 9999; this.style.color = '#fff'; this.style.background = '#0099ff'; this.style.padding = '5px 5px'; this.style.filter = "alpha(opacity=100)"; this.style.opacity = 1 } })(oTag) aA[i].onmouseout = (function(obj) { return function() { obj.on = false; this.style.zIndex = obj.zIndex; this.style.color = '#fff'; this.style.background = '#30899B'; this.style.padding = '5px'; this.style.filter = "alpha(opacity=" + 100 * obj.alpha + ")"; this.style.opacity = obj.alpha; this.style.zIndex = obj.zIndex } })(oTag) oTag.offsetWidth = aA[i].offsetWidth; oTag.offsetHeight = aA[i].offsetHeight; mcList.push(oTag) } sineCosine(0, 0, 0); positionAll(); (function() { update(); setTimeout(arguments.callee, 40) })() }; function update() { var a, b, c = 0; a = (Math.min(Math.max( - mouseY, -size), size) / radius) * tspeed; b = ( - Math.min(Math.max( - mouseX, -size), size) / radius) * tspeed; lasta = a; lastb = b; if (Math.abs(a) <= 0.01 && Math.abs(b) <= 0.01) { return } sineCosine(a, b, c); for (var i = 0; i < mcList.length; i++) { if (mcList[i].on) { continue } var rx1 = mcList[i].cx; var ry1 = mcList[i].cy * ca + mcList[i].cz * ( - sa); var rz1 = mcList[i].cy * sa + mcList[i].cz * ca; var rx2 = rx1 * cb + rz1 * sb; var ry2 = ry1; var rz2 = rx1 * ( - sb) + rz1 * cb; var rx3 = rx2 * cc + ry2 * ( - sc); var ry3 = rx2 * sc + ry2 * cc; var rz3 = rz2; mcList[i].cx = rx3; mcList[i].cy = ry3; mcList[i].cz = rz3; per = d / (d + rz3); mcList[i].x = (howElliptical * rx3 * per) - (howElliptical * 2); mcList[i].y = ry3 * per; mcList[i].scale = per; var alpha = per; alpha = (alpha - 0.6) * (10 / 6); mcList[i].alpha = alpha * alpha * alpha - 0.2; mcList[i].zIndex = Math.ceil(100 - Math.floor(mcList[i].cz)) } doPosition() } function depthSort() { var i = 0; var aTmp = []; for (i = 0; i < aA.length; i++) { aTmp.push(aA[i]) } aTmp.sort(function(vItem1, vItem2) { if (vItem1.cz > vItem2.cz) { return - 1 } else if (vItem1.cz < vItem2.cz) { return 1 } else { return 0 } }); for (i = 0; i < aTmp.length; i++) { aTmp[i].style.zIndex = i } } function positionAll() { var phi = 0; var theta = 0; var max = mcList.length; for (var i = 0; i < max; i++) { if (distr) { phi = Math.acos( - 1 + (2 * (i + 1) - 1) / max); theta = Math.sqrt(max * Math.PI) * phi } else { phi = Math.random() * (Math.PI); theta = Math.random() * (2 * Math.PI) } mcList[i].cx = radius * Math.cos(theta) * Math.sin(phi); mcList[i].cy = radius * Math.sin(theta) * Math.sin(phi); mcList[i].cz = radius * Math.cos(phi); aA[i].style.left = mcList[i].cx + oDiv.offsetWidth / 2 - mcList[i].offsetWidth / 2 + 'px'; aA[i].style.top = mcList[i].cy + oDiv.offsetHeight / 2 - mcList[i].offsetHeight / 2 + 'px' } } function doPosition() { var l = oDiv.offsetWidth / 2; var t = oDiv.offsetHeight / 2; for (var i = 0; i < mcList.length; i++) { if (mcList[i].on) { continue } var aAs = aA[i].style; if (mcList[i].alpha > 0.1) { if (aAs.display != '') aAs.display = '' } else { if (aAs.display != 'none') aAs.display = 'none'; continue } aAs.left = mcList[i].cx + l - mcList[i].offsetWidth / 2 + 'px'; aAs.top = mcList[i].cy + t - mcList[i].offsetHeight / 2 + 'px'; aAs.filter = "alpha(opacity=" + 100 * mcList[i].alpha + ")"; aAs.zIndex = mcList[i].zIndex; aAs.opacity = mcList[i].alpha } } function sineCosine(a, b, c) { sa = Math.sin(a * dtr); ca = Math.cos(a * dtr); sb = Math.sin(b * dtr); cb = Math.cos(b * dtr); sc = Math.sin(c * dtr); cc = Math.cos(c * dtr) }...
2021-2-2
EMlog文章访问密码美化

EMlog文章访问密码美化

教程简介原生态的文章加密访问页面是不是看腻了 也感觉很丑了啊 此页面由孟坤博客美化了文章加密页面替换教程01. 页面路径 include/model/log_model.php02. 将原生页面代码修改成美化页面代码哦03. 也就是修改405~431行代码哦原生代码 if ($pwd !== addslashes($logPwd)) { echo <<<EOT <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>emlog message</title> <style type="text/css"> <!-- body{background-color:#F7F7F7;font-family: Arial;font-size: 12px;line-height:150%;} .main{background-color:#FFFFFF;margin-top:20px;font-size: 12px;color: #666666;width:580px;margin:10px 200px;padding:10px;list-style:none;border:#DFDFDF 1px solid;} --> </style> </head> <body> <div class="main"> <form action="" method="post"> 请输入该文章的访问密码<br> <input type="password" name="logpwd" /><input type="submit" value="进入.." /> <br /><br /><a href="$url">&laquo;返回首页</a> </form> </div> </body> </html> EOT; if ($cookiePwd) { setcookie('em_logpwd_' . $logid, ' ', time() - 31536000); }修改如下 if ($pwd !== addslashes($logPwd)) { ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="renderer" content="webkit"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title>该文章已被加密</title> </head> <body> <div class="main"> <img class="alert" alt="文章已被加密" src="https://www.tx7.co/content/templates/FLY/img/mima.png"> <form action="" method="post" class="mk-side-form"> <h2 class="pw-tip">该文章已被加密</h2> <input type="password" name="logpwd" placeholder="请输入访问密码查看" required><button type="submit">提交</button> <?php if($postPwd): ?> <p id="pw-error">Oops!密码不对哦~</p> <script>setTimeout(function() {document.getElementById("pw-error").style.display = "none"}, 2000);</script> <?php endif; ?> </form> <a href="<?php echo $url; ?>" class="return-home" title="点击回到网站首页">- 返回首页 - </a> </div> <style type="text/css"> *{font-family:"Microsoft Yahei",微软雅黑,"Helvetica Neue",Helvetica,"Hiragino Sans GB","WenQuanYi Micro Hei",sans-serif;box-sizing:border-box;margin:0px;padding:0px;font-size:14px;-webkit-transition:.2s;-moz-transition:.2s;-ms-transition:.2s;-o-transition:.2s;transition:.2s} html,body{width:100%;height:100%} body{background-color:#F4F6F9;color:#768093} input,button{font-size:1em;border-radius:3px;-webkit-appearance:none} input{width:100%;padding:5px;box-sizing:border-box;border:1px solid #e5e9ef;background-color:#f4f5f7;resize:vertical} input:focus{background-color:#fff;outline:none} button{border:0;background:#6abd09;color:#fff;cursor:pointer;opacity:1;user-select:none} button:hover,button:focus{opacity:.9} button:active{opacity:1} .main{width:100%;max-width:500px;height:300px;padding:30px;background-color:#fff;border-radius:2px;box-shadow:0 10px 60px 0 rgba(29,29,31,0.09);transition:all .12s ease-out;position:absolute;left:0;top:0;bottom:0;right:0;margin:auto;text-align:center} .alert{width:80px} .mk-side-form{margin-bottom:28px} .mk-side-form input{float:left;padding:2px 10px;width:77%;height:37px;border:1px solid #ebebeb;border-right-color:transparent;border-radius:2px 0 0 2px;line-height:37px} .mk-side-form button{position:relative;overflow:visible;width:23%;height:37px;border-radius:0 2px 2px 0;text-transform:uppercase} .pw-tip{font-weight:normal;font-size:26px;text-align:center;margin:25px auto} #pw-error {color: red;margin-top: 15px;margin-bottom: -20px;} .return-home{text-decoration:none;color:#b1b1b1;font-size:16px} .return-home:hover{color:#1E9FFF;letter-spacing:5px} </style> </body> </html> <?php if ($cookiePwd) { setcookie('em_logpwd_' . $logid, ' ', time() - 31536000); }...
主题相关 1252次浏览0条评论
2021-2-1
EMlog鼠标点击爱心特效

EMlog鼠标点击爱心特效

代码: <script> !function(e, t, a) { function r() { for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x + "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999"); requestAnimationFrame(r) } function n() { var t = "function" == typeof e.onclick && e.onclick; e.onclick = function(e) { t && t(), o(e) } } function o(e) { var a = t.createElement("div"); a.className = "heart", s.push({ el: a, x: e.clientX - 5, y: e.clientY - 5, scale: 1, alpha: 1, color: c() }), t.body.appendChild(a) } function i(e) { var a = t.createElement("style"); a.type = "text/css"; try { a.appendChild(t.createTextNode(e)) } catch(t) { a.styleSheet.cssText = e } t.getElementsByTagName("head")[0].appendChild(a) } function c() { return "rgb(" + ~~ (255 * Math.random()) + "," + ~~ (255 * Math.random()) + "," + ~~ (255 * Math.random()) + ")" } var s = []; e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function(e) { setTimeout(e, 1e3 / 60) }, i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"), n(), r() } (window, document); </script>...
主题相关 1027次浏览0条评论
2021-1-31
分享一个emlog非插件实现读者排行榜的方法

分享一个emlog非插件实现读者排行榜的方法

代码由flyercn分享,本站只做转载登记之用,代码可能要自己稍稍修改才能使用,如有疑问,留言咨询,这个创建一个文件,例如:comtop.php,把代码放入这个文件中,然后直接把这个文件放入网站根目录即可。<?php //读者墙汇总页面require_once 'init.php';define('TEMPLATE_PATH', TPLS_PATH.Option::get('nonce_templet').'/');$CACHE = Cache::getInstance();$options_cache = $CACHE->readCache('options');extract($options_cache);$navibar = unserialize($navibar);$curpage = CURPAGE_HOME;$site_title = "分享一个emlog非插件实现读者排行榜的方法";$site_key = 'emlog评论者排行榜';$site_description = '统计访问舍力博客且有留言的网友,前9名评论者有外链,已经去除作者和无链接者评论';include View::getView('header');?><style>.dzq{margin:auto;margin:10px 0 0-10px;}.dzq ul{clear:both;overflow:hidden;}.dzq ul li{width:33.333333333333333%;float:left; line-height:20px; }.dzq ul li dd{border:1px solid #ccc;clear:both;overflow:hidden;margin:0 0px 5px 10px;background:url(vip.png) no-repeat left -1px}.dzq ul li p{float:left;margin:10px 10px 10px 10px;}.dzq1{margin:auto; margin-left:-5px;}.dzq1 ul{width:8.333333333333333333333333%;float:left;}.dzq1 ul li{border:1px solid #ccc;margin:5px 0 5px 5px;clear:both;overflow:hidden;}.dzq1 ul li p{text-align:center; margin-top:5px;}.dzq1 ul li h4{text-align:center; height:25px; overflow:hidden; line-height:25px;}.sm{clear:both;overflow:hidden; font-size:14px; border:1px solid #ccc; padding:10px;}</style><?phpglobal $CACHE;$user_cache = $CACHE->readCache('user');$name = $user_cache[1]['name'];$DB = MySql :: getInstance();$sql = "SELECT count(*) AS comment_nums,poster,mail,url FROM ".DB_PREFIX."comment where date >0 and poster !='".$name ."' and url!='' and hide ='n' group by poster order by comment_nums DESC limit 0,200";$result = $DB -> query($sql );$x=1; while($row = $DB -> fetch_array($result ) )if ($x<=1) {{if($row['url']){$tmp = "<ul><li><dd><a target=\"_blank\" href=".$row['url']."><p><img alt='' src=".myGravatar($row['mail'])." height=\"40\" width=\"40\" /></p><h4>第一名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></li></dd>";}else{$tmp = $img;}$output .= $tmp;$x++;}}elseif($x<=2){if($row['url']){$tmp = "<li><dd><a target=\"_blank\" href=".$row['url']."><p><img alt='' src=".myGravatar($row['mail'])." height=\"40\" width=\"40\" /></p><h4>第二名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=3){if($row['url']){$tmp = "<li><dd><a target=\"_blank\" href=".$row['url']."><p><img alt='' src=".myGravatar($row['mail'])." height=\"40\" width=\"40\" /></p><h4>第三名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=4){if($row['url']){$tmp = "<li><dd><a target=\"_blank\" href=".$row['url']."><p><img alt='' src=".myGravatar($row['mail'])." height=\"40\" width=\"40\" /></p><h4>第四名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=5){if($row['url']){$tmp = "<li><dd><a target=\"_blank\" href=".$row['url']."><p><img alt='' src=".myGravatar($row['mail'])." height=\"40\" width=\"40\" /></p><h4>第五名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=6){if($row['url']){$tmp = "<li><dd><a target=\"_blank\" href=".$row['url']."><p><img alt='' src=".myGravatar($row['mail'])." height=\"40\" width=\"40\" /></p><h4>第六名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=7){if($row['url']){$tmp = "<li><dd><a target=\"_blank\" href=".$row['url']."><p><img alt='' src=".myGravatar($row['mail'])." height=\"40\" width=\"40\" /></p><h4>第七名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=8){if($row['url']){$tmp = "<li><dd><a target=\"_blank\" href=".$row['url']."><p><img alt='' src=".myGravatar($row['mail'])." height=\"40\" width=\"40\" /></p><h4>第八名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=9){if($row['url']){$tmp = "<li><dd><a target=\"_blank\" href=".$row['url']."><p><img alt='' src=".myGravatar($row['mail'])." height=\"40\" width=\"40\" /></p><h4>第九名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li></ul></div><div class=\"dzq1\">";}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x>=10){$img = ""; if($row['url']){$tmp = "<ul><li><a target=\"_blank\" href=\"".BLOG_URL."go/?url=".$row['url']."\" title=\"【第".$x."名】 评论:".$row['comment_nums']."\"><p><img alt='".$row['poster']."' src=".myGravatar($row['mail'])." height=\"40\" width=\"40\" /><p><h4>".$row['poster']."</h4></a></li></ul>";}else{$tmp = $img;}$output .= $tmp;$x++;}$output = '<div class="sm">说明(以下链接的来源,仅显示前200名评论者;顺序:留言数 —> 最新评论者):<br />在舍力博客随便一篇文章中留言(图像为Gravatar),通过审核即可上榜。<br />排名为留言次数最多(审核通过的次数),前9名评论者加红显示,已经去除作者和无链接者评论</div><div class="dzq">'.$output .'</div>';echo $output ;?><?php include View::getView('footer');?>  ...
主题相关 1023次浏览0条评论
2021-1-30
为自己的博客增加打赏功能之EMLOG博客教程

为自己的博客增加打赏功能之EMLOG博客教程

经常在一些博客中看到有一个打赏功能。今天也写了一个简单的打赏功能代码,需要注意的是,博客必须加载js,emlog博客默认为include/lib/js/jquery/jquery-1.7.1.js,不确定是否会与你们本身的主题特效有冲突。还有的就是,动手之前,记得备份,养成好习惯!第一步:在js中写入下面代码function dashangToggle(){$(".shang_box").fadeToggle();}function changeItem(i){var k = 3;for(var j = 0;j < k;j++){if(j == i){document.getElementById("sl_shang" + j).style.display = "block";}else{document.getElementById("sl_shang" + j).style.display = "none";}}}function opay(){document.getElementById("sl_shang").target="_parent";}//制作打赏js第2步:在css中插入如下代码.sy_shang{clear:both;overflow:hidden;}.shang_box{width:300px;height:300px;padding:10px;background-color:#fff;border-radius:10px;position:fixed;z-index:1000;left:50%;top:50%;margin-left:-200px;margin-top:-200px;border:1px dotted #dedede;display:none;}.dashang{display:block;width:100px;margin:5px auto;height:25px;line-height:25px;padding:10px;background-color:#E74851;color:#fff;text-align:center;text-decoration:none;border-radius:10px;font-weight:bold;font-size:16px;transition:all 0.3s;}.dashang:hover{opacity:0.8;padding:15px;font-size:18px;}#sl_shang0,#sl_shang1,#sl_shang2{text-align:center;}#sl_shang0 img,#sl_shang1 img,#sl_shang2 img{max-width:260px;}.sl_shang{overflow:hidden;}.sl_shang b{font-size:18px;}.sl_shang ul{margin-top:10px; clear:both; overflow:hidden;}.sl_shang li{float:left;margin-left:10px;}第3步:在需要放置的地方插入下面代码,注意把其中的图片地址改为你自己的哦。<div class="sy_shang"><a href="javascript:void(0)" onclick="dashangToggle()" class="dashang" title="打赏,支持一下">打赏</a><div class="shang_box"><a href="javascript:void(0)" onclick="dashangToggle()" title="关闭" style="float:right;">X</a><div id="sl_shang" onsubmit="return postcheck()"><div class="sl_shang"><b>打赏方式:</b><ul><li><input type="radio" name="paytype" onclick="opay();return changeItem(0);" checked="checked" />支付宝</li><li><input type="radio" name="paytype" onclick="opay();return changeItem(1);" />微信</li><li><input type="radio" name="paytype" onclick="opay();return changeItem(2);" />QQ红包</li></ul></div><div id="sl_shang0"><img src="//www.shuyong.net/content/uploadfile/images/shang/zfb.jpg"><br>打开支付宝扫一扫</div><div id="sl_shang1" style="display:none;"><img src="//www.shuyong.net/content/uploadfile/images/shang/wx.jpg"><br>使用微信扫一扫</div><div id="sl_shang2" style="display:none;"><img src="//www.shuyong.net/content/uploadfile/images/shang/qq.jpg"><br>打开QQ扫一扫</div></div></div></div>...
主题相关 1092次浏览0条评论
2021-1-30
非插件实现emlog博客文章点赞功能

非插件实现emlog博客文章点赞功能

具体操作步骤:1、在当前主题的module.php文件添加以下代码:<?php //点赞function syzan(){ $DB = MySql::getInstance(); if($DB->num_rows($DB->query("show columns from ".DB_PREFIX."blog like 'slzan'")) == 0){ $sql = "ALTER TABLE ".DB_PREFIX."blog ADD slzan int unsigned NOT NULL DEFAULT '0'"; $DB->query($sql); }}syzan();function update($logid){ $logid = intval($_POST['id']); $DB = Database::getInstance(); $DB->query("UPDATE " . DB_PREFIX . "blog SET slzan=slzan+1 WHERE gid=$logid"); setcookie('slzanpd_'. $logid, 'true', time() + 31536000);}function lemoninit() { if( @$_POST['plugin'] == 'slzanpd' &&@$_POST['action'] == 'slzan' &&isset($_POST['id'])){ $id = intval($_POST['id']); header("Access-Control-Allow-Origin: *"); update($id);echo getnum($id);die; }}lemoninit();function getnum($id){ static $arr = array(); $DB = Database::getInstance(); if(isset($arr[$logid])) return $arr[$logid]; $sql = "SELECT slzan FROM " . DB_PREFIX . "blog WHERE gid=$id"; $res = $DB->query($sql); $row = $DB->fetch_array($res); $arr[$id] = intval($row['slzan']); return $arr[$id];}?>2、在主题的header.php文件的</head>前面添加以下代码:<script type="text/javascript">$(document).on('click', '.slzanpd', function() { var a = $(this), id = a.data('slzanpd'); if (slzanpd_check(id)) { alert('您已赞过本文!'); } else { $.post('', { plugin: 'slzanpd', action: 'slzan', id: id }, function(b) { a.find('u').html(b); slzanpd_(a); }); }});function slzanpd_check(id) { return new RegExp('slzanpd_' + id + '=true').test(document.cookie);}$('[data-slzanpd]').each(function() { var a = $(this), id = a.data('slzanpd'); if (slzanpd_check(id)) { slzanpd_(a); } else { a.attr('title', '给emlly来点动力吧!') }});function slzanpd_(a) { a.css('cursor', 'not-allowed').attr('title', '您已赞过本文!');}</script>3、在主题的echo_log.php文件的<?php echo $log_content; ?>下面添加以下代码:<div class="ding"> <a class="slzanpd" data-slzanpd="<?php echo $logData['logid'];?>" title="喜欢这篇文章就赞一个吧!">赞(<?php echo(isset($logData['slzan'])?$logData['slzan']:getnum($logData['logid']));?>次)</a></div>4、在主题里style.css文件添加以下代码:/*点赞*/.ding {overflow:hidden; font-size:14px;}.ding a {display:block; float:left; background-color:#1F90DE; color:#fff; border-radius:3px; padding:5px 30px; cursor:pointer;margin-left: 360px;}.ding a:hover {color:#fff;}...
主题相关 1176次浏览0条评论
微信二维码
Sitemap