常用代码合集
包含语言:html,css,js,php,sql
自己整理的,常用代码合集!更新日:2018.5.19
—————————————————————————————————————————————————————————————————————————————————————
====================JS调用时间日期星期!
<script language=JavaScript>
var d = new Date();
var week; switch (d.getDay()) { case 1: week = "星期一"; break; case 2: week = "星期二"; break; case 3: week = "星期三"; break; case 4: week = "星期四"; break; case 5: week = "星期五"; break; case 6: week = "星期六"; break; default: week = "星期天"; }
var years = d.getFullYear();
var month = add_zero(d.getMonth() + 1);
var days = add_zero(d.getDate());
function add_zero(temp) { if (temp < 10) return "0" + temp; else return temp; }
document.write("<li style=' padding-top:8px; padding-left:50px;color:rgba(255,255,255,1);'>成都盐城商会欢迎您! 今天是" + years + "年" + month + "月" + days + "日" + " " + week + "</li>");
</script>
—————————————————————————————————————————————————————————————————————————————————————
=======================设置指定字体!
@font-face {
font-family: 'HELVETICANEUELTPRO-THEX';
src: url('/css/HELVETICANEUELTPRO-THEX.otf');
font-weight: normal;
font-style: normal;
}
—————————————————————————————————————————————————————————————————————————————————————
===================字体渐变色!
background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(rgba(0, 128, 0, 1)), to(rgba(51, 51, 51, 1)));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
—————————————————————————————————————————————————————————————————————————————————————
================================li标签里面正确使用 程序代码 格式!(分开调用时间日期年月日)
$listtemp='
<div id="newsitem_0" class="wow newstitem left"><a class="newscontent" target="_blank" href="[!--titleurl--]">
<div class="news_wrapper">
<div class="newsbody">
<p class="date"><span class="md"> '.date("M",$r[newstime]).' <span>-</span></span><span class="year"> '.date("d",$r[newstime]).' </span></p>
<p class="title">[!--title--]</p>
<div class="separator"></div>
<p class="description">[!--smalltext--]...</p>
</div>
</div>
<div class="newsimg" style="background-image:url(/)"></div>
</a> <a href="[!--titleurl--]" target="_blank" class="details">more<i class="fa fa-angle-right"></i></a> </div>
';
—————————————————————————————————————————————————————————————————————————————————————
============js函数调用!!!
function show(){
document.getElementById("dell").style.display="";
}
function hidden(){
document.getElementById("dell").style.display="none";
}
===============调用方法!!!
<input style="width:100px;" name="name" type="button" onClick=“show();” value="删除">
—————————————————————————————————————————————————————————————————————————————————————
============页面中获取数据表里面的数据!
<?php
$conn=mysql_connect('localhost','lllzjd','Eyx5-3K86-A4m1');
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
$sele=mysql_select_db( 'lllzjd' );
$lll=mysql_query("set names utf8");
$result = mysql_query("SELECT * FROM lllzjd_enewsfeedback");
echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['job'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($conn);
?>
—————————————————————————————————————————————————————————————————————————————————————
============制作单独的php文件,html好调用!action="/js/anniu.php"
<html> <body> ID:<?php echo $_POST["lid"]; ?><br> 完成情况:<?php echo $_POST["wcqk"]; ?> <?php if ($_POST["lid"]==null) { echo "请输入正确的ID号!"; } else { $abcd=$_POST["lid"]; $dcba=$_POST["wcqk"]; $conn=mysql_connect('localhost','lllzjd','Eyx5-3K86-A4m1'); $sele=mysql_select_db( 'lllzjd' ); $result=mysql_query("update lllzjd_enewsfeedback set job=$dcba where id=$abcd"); mysql_close($conn); } ?> </body> </html>
====================html调用方法!!!action="/js/anniu.php"
<div align="center">
<div style="border:3px solid #f8f8f8; background: rgba(255,255,255,1); max-width:1210px;-webkit-box-shadow: 2px 2px 8px #666;" align="center" aos="flip-down">
<form id="mmm" action="/js/anniu.php" method="post">
请输入对应ID号修改(必须数字): <input id="mmm" type="text" name="lid">
完成情况:<select id="mmm" type='text' name='wcqk'>
<option>12345</option>
<option>21345</option>
<option>31245</option>
<option>41235</option>
<option>51234</option>
</select>
<script>
var a = {};
if(!a){ console.log(1);}
else if(a == null) { console.log(2);}
else { console.log(3);}
</script>
<input id="mmm" type="submit" value="修改" />
说明:12345=未进行;21345=进行中;31245=已完成;41235=已移交;51234=已终止。
</form>
</div>
</div>
—————————————————————————————————————————————————————————————————————————————————————
===============解决乱码问题!!!$lll=mysql_query("set names utf8"); 这个是重点!!!
mysql_query("set names utf8"); 这样写也可以!!不用变量
<?php header("Content-type: text/html; charset=utf-8"); if ($_POST["lid"]==null) { echo "<h1 style='color:red'>请输入正确的ID号!</h1>"; } else { $abcd=$_POST["lid"]; $dcba=$_POST["wcqk"]; $conn=mysql_connect('localhost','lllzjd','Eyx5-3K86-A4m1'); $sele=mysql_select_db( 'lllzjd' ); $lll=mysql_query("set names utf8"); $result=mysql_query("update lllzjd_enewsfeedback set job='$dcba' where id=$abcd"); mysql_close($conn); echo "<h1 style='color:rgba(0,255,0,1)'>修改成功!页面将会在5分钟内更新为最新数据!</h1>"; } ?>
—————————————————————————————————————————————————————————————————————————————————————
============php直接修改数据表!!!
<?php
header("Content-type:text/html;charset=utf-8");
$conn=mysql_connect('localhost','lllzjd','Eyx5-3K86-A4m1');
if (!$conn) {
die("连接服务器失败: ");
}
$sele=mysql_select_db( 'lllzjd' );
if(!$sele){
die("连接数据库失败: ");
}
$result=mysql_query("update lllzjd_enewsfeedback set job='已完成' where id=46");
mysql_close($conn);
?>
==============php删除对应id数据!
$result=mysql_query("delete from lllzjd_enewsfeedback where id=$abcd");
—————————————————————————————————————————————————————————————————————————————————————
===========让页面特定文字变色!
<script type="text/javascript">
document.body.innerHTML = document.body.innerHTML.replace(/已完成/ig,"<span style='color:rgba(0,255,0,1);'>$&</span>");
document.body.innerHTML = document.body.innerHTML.replace(/未完成/ig,"<span style='color: red;'>$&</span>");
</script>
—————————————————————————————————————————————————————————————————————————————————————
=============直接sql调用数据表内容!!!
=======这个是带选择条件的!
[e:loop={"select title,company,name,job,mycall,saytext from lllzjd_enewsfeedback where title='Lzjd'",99,24,0,'newstime DESC'}]
[e:loop={'select title from lllzjd_enewsfeedback',99,24,0}]
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br>
[/e:loop]
—————————————————————————————————————————————————————————————————————————————————————
============鼠标移进移出! a.style.backgroundColor = "red"; MouseOver(a)
onmouseover="MouseOver(this)"
<script type="text/javascript">
function MouseOver(a)
{
a.style.width = "500px";
}
function MouseOut(a)
{
a.style.width = "100px";
}
</script>
—————————————————————————=——————=—————=—————=——————上面方式1用变量,下面方式2不用变量!
<script type="text/javascript">
function MouseOver()
{
alert('hahahahahaha');
}
function MouseOut()
{
alert('121212412412');
}
</script>
===========调用方式
<div onmouseover="MouseOver()" onmouseout="MouseOut()"> </div>
—————————————————————————————————————————————————————————————————————————————————————
============头部文件!!!
<link rel="stylesheet" href="/css/aos.css" />
<script type="text/javascript" src="/js/aos.js"></script>
============以下放在使用位置!!!
<script>AOS.init({easing: 'ease-out-back',duration: 3000});</script>
=============
调用方式aos=“xxx”
—————————————————————————————————————————————————————————————————————————————————————
===============评论回复代码!!!手机版需要单独把skin文件夹拷贝到mobile里面!!!
<a href="#tosaypl" onclick="javascript:document.saypl.saytext.value+='回复[!--plid--]楼:';document.saypl.repid.value='[!--plid--]';document.saypl.saytext.focus();">回复</a>
—————————————————————————————————————————————————————————————————————————————————————
<li><a class="btn_3" href="tel:0516-89888771">打电话</a></li> =======拨打电话
<li><a class="btn_2" href="sms:138-1349-1559 ">发短信</a></li> =======发短信
<li><a class="btn_1" href="mailto:2568128049@qq.com">发邮件</a></li> ====发邮件
—————————————————————————————————————————————————————————————————————————————————————
js 代码必须被<script></script>包裹!!! ====这个是下面的说明======各种页面作判断的js语句
两种方法
方法1:在需要显示值的地方用这一名输出
document.write sVar
sVar代表变量名
方法2:在任意位置写入JS
document.getElementById(”obj“).innerHTML=sVar
其中obj为需要输出值的元素ID,如div、span等
<script> document.title=abc+" - 产品中心"+" - 饮料设备网" </script> ===title输出方法!
<span id="abc">-<script>document.write (abc);</script></span> ===输出方法!
var abc=0; ======这个定义到</head>前面!!!
abc=window.location.href;
if(abc=="http://www.drinksm.com/cpzx/bzxs/PET"){abc="PET";}
else if(abc=="http://www.drinksm.com/cpzx/zxfl/%E9%A5%AE%E7%94%A8%E6%B0%B4"){abc="饮用水";}
else if(abc=="http://www.drinksm.com/cpzx/zxfl/%E6%9E%9C%E8%94%AC"){abc="果蔬汁及其饮料";}
else{ abc=" "; }
document.getElementById("span").innerHTML=abc;
—————————————————————————————————————————————————————————————————————————————————————
onclick="window.open(‘/cpzx/’) =====单击事件
—————————————————————————————————————————————————————————————————————————————————————
php 5.2.12 及以上的版本 php.ini 里有个 max_file_uploads: 默认数值是20,也就是:=====图片集限制
max_file_uploads:20
—————————————————————————————————————————————————————————————————————————————————————
==========窗口小于1000px的时候隐藏。
<style>
@media screen and (max-width: 1000px){
.div2{display: none;}
}
</style>
—————————————————————————————————————————————————————————————————————————————————————
=============复制以下代码替换掉e/search/result/index.php内的所有内容!搜索模板支持变红字和标签支持!
<?php
require('../../class/connect.php');
require('../../class/db_sql.php');
require('../../class/functions.php');
require('../../class/t_functions.php');
require('../../data/dbcache/class.php');
require "../".LoadLang("pub/fun.php");
$editor=1;
eCheckCloseMods('search');//关闭模块
$link=db_connect();
$empire=new mysqlquery();
$getvar=$_GET['getvar'];
if(empty($getvar)) {
$getfrom="history.go(-1)";
} else {
$getfrom="../../../search/";
}
//搜索结果
$searchid=(int)$_GET['searchid'];
if(empty($searchid)) {
printerror("SearchNotRecord",$getfrom,1);
}
$search_r=$empire->fetch1("select searchid,keyboard,result_num,orderby,myorder,tbname,tempid,andsql,trueclassid from {$dbtbpre}enewssearch where searchid='$searchid'");
if(empty($search_r['searchid'])||InfoIsInTable($search_r[tbname])) {
printerror("SearchNotRecord",$getfrom,1);
}
$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$start=0;
$page_line=$public_r['search_pagenum'];//每页显示链接数
$line=$public_r['search_num'];//每页显示记录数
$offset=$page*$line;//总偏移量
$search="&searchid=".$searchid;
$myorder=$search_r[orderby];
if(empty($search_r[myorder])) {
$myorder.=" desc";
}
$add=stripSlashes($search_r['andsql']);
$num=$search_r[result_num];
$query="select * from {$dbtbpre}ecms_".$search_r[tbname].($add?' where '.substr($add,5):'');
$query.=" order by ".$myorder." limit $offset,$line";
$sql=$empire->query($query);
$listpage=page1($num,$line,$page_line,$start,$page,$search);
//取得模板
if($search_r['tempid']) {
$tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$search_r['tempid']."' limit 1");
} elseif(empty($class_r[$search_r[trueclassid]][searchtempid])) {
$tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1 limit 1");
} else {
$tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$class_r[$search_r[trueclassid]][searchtempid]."' limit 1");
}
$have_class=1;//页面支持标签
$tempr[temptext]=DtNewsBq('listsearch'.$search_r['tempid'],$tempr[temptext],0);//替换公共模板变量
$listtemp=$tempr[temptext];
if($public_r['searchtempvar']) { $listtemp=ReplaceTempvar($listtemp);
}
$search_r[keyboard]=ehtmlspecialchars($search_r[keyboard]);
$listtemp=str_replace("[!--show.page--]",$listpage,$listtemp);
$listtemp=str_replace("[!--keyboard--]",$search_r[keyboard],$listtemp);
$listtemp=str_replace("[!--ecms.num--]",$num,$listtemp);
$url="<a href='".ReturnSiteIndexUrl()."'>".$fun_r['index']."</a> > ".$fun_r['adsearch'];
$pagetitle=$fun_r['adsearch']." ".$search_r[keyboard];
$listtemp=ReplaceSvars($listtemp,$url,0,$pagetitle,$pagetitle,$pagetitle,$add,0);
$rownum=$tempr[rownum];
if(empty($rownum)) { $rownum=1;
}
$formatdate=$tempr[showdate];
$subnews=$tempr[subnews];
$subtitle=$tempr[subtitle];
$docode=$tempr[docode];
$modid=$tempr[modid];
$listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tempr[listvar]);
//字段
$ret_r=ReturnReplaceListF($tempr[modid]);
//取得列表模板
$list_exp="[!--empirenews.listtemp--]";
$list_r=explode($list_exp,$listtemp);
$listtext=$list_r[1];
$no=$offset+1;
$changerow=1;
while($r=$empire->fetch($sql)) {
//替换列表变量
$repvar=ReplaceListVars($no,$listvar,$subnews,$subtitle,$formatdate,$url,$have_class,$r,$ret_r,$docode);
$listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
$listtext=str_replace($search_r[keyboard],"<font color='red'>$search_r[keyboard]</font>",$listtext);
$changerow+=1;
//超过行数
if($changerow>$rownum) {
$changerow=1;
$string.=$listtext;
$listtext=$list_r[1];
} $no++;
} db_close();
$empire=null;
//多余数据
if($changerow<=$rownum&&$listtext<>$list_r[1]) {
$string.=$listtext;
}
$string=$list_r[0].$string.$list_r[2];
echo stripSlashes($string);
?>
—————————————————————————————————————————————————————————————————————————————————————
================自动刷新一次网页
<script>
window.onload=function(){
if (location.href.indexOf("")<0)
{
location.href=location.href+""+Math.random();
}
}
</script>
==============高级版
<Script>
function reurl(){
url = location.href; //把当前页面的地址赋给变量 url
var times = url.split("?"); //分切变量 url 分隔符号为 "?"
if(times[1] != 1){ //如果?后的值不等于1表示没有刷新
url += "?1"; //把变量 url 的值加入 ?1
self.location.replace(url); //刷新页面
}
}
onload=reurl
</script>
—————————————————————————————————————————————————————————————————————————————————————
=============图片集调用方法!
<?php
$picr=explode(egetzy('rn'),$navinfor[morepic]);
for($p=0;$p<count($picr);$p++)
{
$spicr=explode("::::::",$picr[$p]);
?>
小图地址:<img width="20px" src="<?=$spicr[0]?>" />
大图地址:<img width="50px" src="<?=$spicr[1]?>" />
图片名称:<?=$spicr[2]?>
<?php
}
?>
—————————————————————————————————————————————————————————————————————————————————————
=======这个是图片判断!有图片出现正常图片,没图片出现指定图片!!!!(需要配合js代码!)
<img data-original="images/1514448665_5193.jpg" class="lazy imgbig" src="images/blank.gif">
—————————————————————————————————————————————————————————————————————————————————————
=====切割图片
<div style="border-radius:50px; overflow:hidden;"><img src="images/tx.jpg"/></div>
=============================防止盗链设置,延迟加载跳转提示警告语言js。这个写到html里面可以,然后调用下面警告语言js!
$(function() {
0 > window.location.host.indexOf(‘lllzjd.com’) && (document.write('<script language="javascript" type="text/javascript" src="http://www.hzvis.com/static/alert.js"></script>'))
});
$(function() {
//延迟加载
$(".lazy").lazyload({
effect: "fadeIn",
threshold: 200
});
=============================防止盗链设置,提示警告语言。(这个写成js文件,方便上面调用!)
function delayer(){
location.href = location.href.replace(document.location.host,’lllzjd.com’);
}
if (document.location.host != "lllzjd.com") {
alert(“这里填写警告语言!”);
setTimeout('delayer()', 3000);
}
—————————————————————————————————————————————————————————————————————————————————————
=============================防止盗链设置,禁止鼠标右键等。
$(document).bind("contextmenu", function(e) { return false; //屏蔽鼠标右键 });
$(function() { document.addEventListener('keydown', function(e) { e = window.event || e; var keycode = e.keyCode || e.which; if (e.ctrlKey && keycode == 83) { //屏蔽Ctrl+s 保存页面 e.preventDefault(); window.event.returnValue = false; } if (e.ctrlKey && keycode == 85) { //屏蔽Ctrl+u 查看页面的源代码 e.preventDefault(); window.event.returnValue = false; } if (keycode == 123) { //屏蔽F12 e.preventDefault(); window.event.returnValue = false; } if (e.ctrlKey && e.shiftKey && keycode == 73) { //屏蔽Ctrl+shift+i 屏蔽调出控制台 和F12一样 e.preventDefault(); window.event.returnValue = false; } }); });
—————————————————————————————————————————————————————————————————————————————————————
========网页跳转代码,这个里面把M换成相应路径即可!
<script type="text/javascript">
try {var urlhash = window.location.hash;
if (!urlhash.match("fromapp"))
{if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
{window.location=window.location.href+"m";}}}
catch(err){}
</script>
在公共模板给一句代码让其跳转到手机访问:(或者直接给首页,根据自己需求来,建议只给首页)
<script type="text/javascript">
try {var urlhash = window.location.hash;
if (!urlhash.match("fromapp"))
{if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
{window.location="http://www.qyhongyan.com/sjbb/";}}}
catch(err){}
</script>
—————————————————————————————————————————————————————————————————————————————————————
<style type="text/css"> ============导航条样式!以及选择高亮!
.headerzithree ul li:hover{
background: url('/images/pc_top_02.png')no-repeat center;
background-position: 0px 2px;
color: #000;
}
.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
.nav{ padding:0 20px; height:83px; line-height:83px; position:absolute; z-index:1; top: 20px;left: 303px; }
.nav a{ color:#fff;}
.nav .nLi{ float:left;position:relative; display:inline;height: 100px;}
.nav .nLi h3{ float:left;}
.nav .nLi h3 a{ display:block; padding:0 20px; font-size:14px; font-weight:bold; }
.nav .sub{ display:none; width:138px; left:-17px; top:98px; position:absolute; background:#CEB80D; line-height:26px; padding:5px 0; filter:alpha(Opacity=80);-moz-opacity:0.8;opacity: 0.8; }
.nav .sub li{ zoom:1; text-align: center;}
.nav .sub a{ display:block; padding:0 10px;font-size: 14px;color:#000; }
.nav .sub a:hover{ background:#000; color:#fff; }
.nav .on h3 a{
background: url('/images/pc_top_02.png')no-repeat center;
background-position: 0px -8px;
background-size: 86%;
}
a{
text-decoration: none;
}
.tongyitwo{
background:#dedede !important;====此为代码强制优先级
height: auto;
float: left;
width: 100%;
}
</style>
—————————————————————————————————————————————————————————————————————————————————————
=============此写在《/head》前面这个是css图片轮播!!!
<style>
.banner .zong{
width:100%;
height:600px;
-webkit-animation:change 10s linear infinite; //10s是整个动画的秒数 infinite是永久循环
}
@-webkit-keyframes change{
0%{
margin-left:0;
}
30%{
margin-left:0;
}
/*总共用10秒,0%到30% 也是3.333秒第一张图片停留位置后面以此类推*/
33%{
margin-left:-2200px;
}
63%{
margin-left:-2200px;
}
66%{
margin-left:-4100px;
}
97%{
margin-left:-4100px;
}
100%{
margin-left:-6000px;
}
}
</style>
============================此为正确的调用方式!!!图片长度是普通图片的3倍!
<div class="banner">
<div class="zong" style=" float:left; z-index:-1; "><img height="600px" src="/images/WechatIMG400.jpg" ></div>
—————————————————————————————————————————————————————————————————————————————————————
<style> *{cursor: url('/images/favicon.ico'),auto;} </style> ======= 鼠标样式
http://p.qiao.baidu.com/cps/chat?siteId=11652330&userId=22194287 =====百度商桥链接
tencent://message/?uin=1234567890 ======QQ聊天链接(mac无法用)
http://wpa.qq.com/msgrd?V=3&uin=713050904&Site=QQ&Menu=yes ======QQ聊天链接(次要)
tencent://message/?uin=40080000&Site=uelike&Menu=yes ======QQ聊天链接
http://wpa.qq.com/msgrd?v=3&uin=2455182434&site=qq&menu=yes ======QQ聊天链接(窗口主要)
mailto:jwtc028@163.com ======邮箱链接
http://service.weibo.com/share/share.php?appkey=3206975293& ======微博链接
—————————————————————————————————————————————————————————————————————————————————————
========结合项试用
后台上传 .htaccess 内容如下
《IfModule mod_rewrite.c》 RewriteEngine On #地区分类 ====$1代表第一个匹配值,$2代表第二个匹配值 RewriteCond %{QUERY_STRING} ^(.*)$ ======这个$1可以换成myarea RewriteRule ^cpzx/(.*)/(.*) /e/action/ListInfo.php?classid=1&ph=1&$1=$2 《/IfModule》
============如果是复合选项就用 模糊搜索!!!
前台调用方式如下
<td width="40" style="text-align: center;"><a href="/cpzx/myarea/山西”>山西</a></td>
—————————————————————————————————————————————————————————————————————————————————————
<?=esub(str_replace("|","|",$bqr[cpfl]),90)?>=======替换“|”php写法
SQl附加条件!
[e:loop={7,10,0,0,”cpfl like ‘%热%’”}]========调用cupf里面带有热字的信息!
[e:loop={7,10,0,0,”cpfl not like ‘%热%’”}]========调用cup里面 不包含 热字的信息!!
[e:loop={7,10,0,0,"xxfl='高校讯息' or xxfl='行业资讯’”}]===调用xxfl等于高效,行业的内容!
切记注意标点符号!!!!=====有可能提示错误,通常都是标点符号的问题!!!!!
—————————————————————————————————————————————————————————————————————————————————————
======================================万能标签调用!!!!!!!!可以实现双层循环!!!
[ecmsinfo]2,9,32,0,0,13,0[/ecmsinfo]
————————————————
[!--empirenews.listtemp--]
<div class="stable">
<ul>
<!--list.var1-->
</ul>
<ul>
<!--list.var2-->
</ul>
<ul>
<!--list.var3-->
</ul>
</div>
[!--empirenews.listtemp--]
————————————————
<li>[!--title--]</li>
<li>[!--ftitle--]</li>
<li>戏剧影视导演</li>
<li>九江市第一中学</li>
—————————————————————————————————————————————————————————————————————————————————————
================百度标签写在头文件里面!
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=fqGoCvV7Q5oCPftqT4ONz0BS"></script>
—————————————————————————————————————————————————————————————————————————————————————
========================视频调用!!!视频调用!!!
<video width="750px" autoplay="autoplay" controls="controls" loop="-1">
<source src="images/sp1.mp4" type="video/mp4"></source>
</video>
——————————————————————————————————————————————————————————————————
<a href="#footer">在线留言</a>============跳转到指定位置!
—————————————————————————————————————————————————————————————————————————————————————
============伪静态代码!!!放在网站更目录下面的用文件.xxxx形式放着的
#栏目
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^cpzx/(.*) /e/action/ListInfo.php?classid=1&ph=1&myarea=$1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(d/|e/|html/|images/|s/|search/|skin/|t/)
RewriteRule ^([0-9a-zA-Z/]+)/(|index\.html|index_[0-9]+\-(.+?).html)$ /e/action/list\.php\?classid=$1&page=$2myarea=$3
#内容
RewriteEngine on
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(d/|e/|html/|images/|s/|search/|skin/|t/)
RewriteRule ^([0-9a-zA-Z/]+)/([0-9a-zA-Z]+)([_0-9]*)\.html$ /e/action/show\.php\?classid=$1&id=$2&page=$3
============================
帝国CMS建议直接生成静态页,但有时候也确实希望伪静态,这里以帝国CMS7.0为例。
PHP虚拟主机下设置伪静态:
1、确认空间支持伪静态,有些空间商的空间是需要手动开启伪静态功能的。
2、后台--系统--系统设置--伪静态参数设置,设置好伪静态规则。
3、新建 .htaccess 文件,放在网站根目录下。
.htaccess文件中写入如下规则:(注意规则文件中的规则要与后台设置的一致)
# 将 RewriteEngine 模式打开
RewriteEngine On
#信息内容页:showinfo-[!--classid--]-[!--id--]-[!--page--].html
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^showinfo-(.+?)-(.+?)-(.+?).html$ /e/action/ShowInfo.php?classid=$1&id=$2&page=$3
#信息列表:listinfo-[!--classid--]-[!--page--].html
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^listinfo-(.+?)-(.+?).html$ /e/action/ListInfo/index.php?classid=$1&page=$2
#标题分类列表页:infotype-[!--ttid--]-[!--page--].html
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^infotype-(.+?)-(.+?).html$ /e/action/InfoType/index.php?ttid=$1&page=$2
#TAGS信息列表页:tags-[!--tagname--]-[!--page--].html
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^tags-(.+?)-(.+?).html$ /e/tags/index.php?tagname=$1&page=$2
——————————————————————————————————————————————————————
======================这个是在栏目里面用于查找调用的php文件调用方法!
<a href=“/e/action/ListInfo.php?classid=[!--self.classid--]&ph=1&myarea=山西">山西</a>
<a href="[!--news.url--]e/action/ListInfo.php?classid=[!--classid--]&ph=1&myarea=[!--myarea--]">[!--myarea--]</a> ======这句不知道能不能正常使用
=====================这个可以加到链接里面直接调用对应自定义字段来使用!!!!!!!(结合项)
/e/action/ListInfo.php?classid=3&ph=1&ztkc=青少年素质特训营
————————————————————————————————————————————
=================字体设置
<style>body {font-family: 微软雅黑;}</style>
————————————————————————————————————————————
=——————========================================================表单提交代码!!!
=================onfocus=if这个是判断语句!
<input type="text" name="mycall" value="联系电话:" class="phone" id="LEAVEWORD_txtMobile" onfocus="if(this.value=='联系电话:'){this.value=''}"
onblur="if(this.value=='')this.value='联系电话:'">
<input type="image" src="/images/aixuexi.jpg"/> =======图片提交按钮!
<div>
<input name="submit" type="image" src=“/img/zc.jpg" width="240" height="25" >
</div>=======================图片提交按钮!!!
<input type="text" class="inputtxt" name="title" placeholder="姓名(*)" autocomplete="off”======这个是判断是否更新字幕! />
==============================表单提交代码如下!
<form name='feedback' method='post' enctype='multipart/form-data' action='/e/enews/index.php'>
<input name='enews' type='hidden' value='AddFeedback'>
<input type='hidden' name='bid' value='1'>============这条很重要,给与提交地址!(手机提交必须有它!)
<div class="cf-column">
<input name="name" id="cp" type="text" placeholder="产品名称" validate="minlength:2, maxlength:50, required:true" class="col-title"/>
</div>
<div class="cf-column">
<input name='title' id="name" type="text" placeholder="名字" validate="minlength:2, maxlength:50, required:true" class="col-username"/>
</div>
<div class="cf-column">
<input name="email" id="email" type="text" placeholder="邮箱" validate="maxlength:40, required:true, email:true" class="col-email"/>
</div>
<div class="cf-column">
<input name="mycall" id="tel" type="text" placeholder="电话/手机" validate="minlength:6, maxlength:40, required:true" class="col-telephone"/>
</div>
<div class="cf-column">
<textarea name="saytext" id="content" placeholder="询问内容" validate="minlength:2, maxlength:200, required:true"></textarea>
</div>
<input type="submit" value="立即发送" id="submit-btn" class="contact-submit btn colored col-md-12 submit-button"/>
<!--<div id="msg" class="message"></div>-->
</form>
-----------------------------------------------------------------------------------------------------------------
<link href="css/lrtk.css" rel="stylesheet" type="text/css" /> ========引入外部css代码
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> ========引入外部js代码
------------------------------------------------------------------------------------------------------------------------------------------------------
=================================================================================DIV图片设置以及防止背景图片平铺
这段是防止背景图片平铺
<div style="color: #FFF; width:250px; height:60px; padding:10px 0px 0px 0px; margin:auto; background-image: url(images/anniu.png);background-repeat:no-repeat;">
------------------------------------------------------------------------------------------------------------------------------------------------------
=================================================如何解决小图标问题
首先,引入css库:
===============这个为最新4.7.0版本
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
==========此为调用本地的字体,把整个字体文件夹放到网站根目录!注意绝对路径!
<link rel="stylesheet" href=“/Font-awesome-4.7.0/css/font-awesome.min.css">
第一步:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
然后,在需要的地方按如下方式引用:
第二步:
<i class="fa fa-star"></i>
--------------------------------------------------------------------------------------------------------------
==================================搜索设置代码,在搜索模板里面用!
注意:输入框关键字设置!
按表调用必须指定tbname和tempid这两个变量
还有搜索关键字是keyboard,不是keyword
/mobile/e/search/index.php ========这个为手机版搜索引用地址
========手机版需要单独把search文件夹拷贝到mobile里面!!!
<form action='/e/search/index.php' method="post" name="search_news" id="search_news" class="searchform">
<input name="classid" type="hidden" id="classid" value="1">
<input type="hidden" name="show" value="title,smalltext,newstext,writer,fzs">
<div class="sform-div">
<input type="text" value="" name="keyboard" placeholder="请输入产品关键字" id="s"/>
<input type="submit" id="searchsubmit" value=""/>
</div>
</form>
————————————————————————class和id都TMD是样式!!!
<div class="searchBar">
<form action='[!--news.url--]e/search/index.php' method="post" name="search_news" id="search_news">
<input name="classid" type="hidden" id="classid" value="1"> ======这条很重要设置搜索的栏目位置
<input size="60" id="keyboard2" type="text" name="keyboard" placeholder="请输入试剂名称或编码" value=""/>
<button class="btn" type="submit" id="search_news"> 搜索 </button>
<input type="hidden" name="show" value="title,smalltext,newstext,writer,fzs">
</form>
</div>
———————————————————————========================网页标签ico代码头部标记
<link rel="shortcut icon" href="/images/favicon.ico"/>
———————————————————————————————————————————————————
———————————————————————========================手机网站的判断语句加到<head>里面
<script type="text/javascript">
if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="http://www.nnchuanrui.com/mobile/";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}
</script>
———————————————————————————————————————————————————
<script type="text/javascript">
var OBJ_TITLE = "关于我们";
var OBJ_ID = "2";
var MARK = "help";
var AD_MARK = "help";
var SID = "[!--self.classid--]";
//权限ID
var AUTHORITY_ID = "";
</script>
=============此为高亮设置!
<ul>
<li sid='[!--self.classid--]'><a href='/gywm/gsjj/'>公司简介</a></li>
<li sid='[!--self.classid--]'><a href='/gywm/qywh/'>企业文化</a></li>
<li sid='[!--self.classid--]'><a href='/gywm/zzjg/'>组织架构</a></li>
<li sid='[!--self.classid--]'><a href='/gywm/lxwm/'>联系我们</a></li>
</ul>
——————————————————————————————
========================================栏目对应栏目亮条标签
<p> <a href="/lbdx.htm" sid='0001,0010,0011' >拉布灯箱</a> </p>
<script type="text/javascript">
productSelectCurrentPosition("0001,0010,0011");
</script>
————————————————————————————————————————————
<ul class="list">
[!--empirenews.listtemp--]
<!--list.var1-->
[!--empirenews.listtemp--]
</ul>
<div class='pagingNav'>
<p>[!--show.listpage--]</p> ===================翻页代码
</div>
发布时间:<?=date('Y-m-d',$bqr[newstime])?> ========灵动标签调用发布时间
<li><span>上一篇:</span>[!--info.pre--]</li>======上下篇代码
—————————————————————————————————————————————————————————
=============================嵌入图片的div框架
.max3{ background:url(../images/l1.png) no-repeat center; height:50px;}
=========================定义内容在页面中自动居中!max2嵌套在max1里面
.max1{ width:100%;}
.max2{ width:350px; margin:auto;}
------------------------------------------------------------------------
样式 固定大小
<div style="width:250px; height:150px; overflow:hidden;">========设置盒子固定大小,不被内容扩大。
--------------------------------------------------------------
==============定义了一个调用名为div-height的盒子
<style> 同一行 宽度 高度 相对位置
.div-height{style="float:left; width:250px; height:150px; margin:20px 30px 10px 85px;}
</style>
<div class="div-height"> =============这个就是调用!
-----------------------------------------------------------------------
================调整盒子内外间距
内间距:padding:上边 右边 下边 左边;(如:padding:0 0 20px 30px;)
外间距:margin值同上
-----------------------------------------------------------------------------
======列表页面替换代码力标签!
<li>
<a href="[!--titleurl--]" title="[!--title--]" target="_blank">
<img src="[!--titlepic--]" alt="[!--title--]" width="220" height="278">
<span>[!--title--]</span>
</a>
</li>
<?=date("Y-m-d H:i:s",$bqr[newstime])?>=====灵动调用日期
<?=esub($bqr[smalltext],30)?>======简介调用
<?=esub($bqr[title],截取字数)?>=====限制字符
<?=$bqr[ftitle]?>======副标题
[e:loop={1,4,0,1,"category='html5'"}] ===========
[e:loop={1,'1,4',0,1,"category='html5'"}] ======改1.4从第二条开始调用
<div style="height:10px"> ======增加宽度和高度的盒子
</div>
时间:[!--newstime--]
来源:[!--befrom--]
作者:[!--writer--]
<a href="[!--news.url--]">返回首页</a>
-----------------------------------------------------------
<div class="left-menu"><!--左侧菜单 start-->
<h2>栏目直达</h2>
<ul>
[showclasstemp]'selfinfo',1,0,0[/showclasstemp] =====这串去生成调用(带模板导航)
</ul>
</div><!--左侧菜单 end-->
-----------------------------------以上写入页面内容
[!--empirenews.listtemp--]
<!--list.var1-->
[!--empirenews.listtemp--]
分上下代码=====list.var下
<li><a href="[!--classurl--]">[!--classname--]</a></li>
------------------------------------------------------------------
<!--导航 start-->
<div class="nav_wrap"> ===============这个是导航的框架
<ul class="nav"> ======这个也是导航的框架
<li><a href="/" >首页</a></li>
[listshowclass]'0',13,0,0[/listshowclass] ========这串也可以去调用(循环导航)
</ul>
</div>
<!--导航 end-->
-----------------------------------以上写入页面内容
<li> 父栏目链接 父栏目名称
<a href="[!--bclassurl--]" >[!--bclassname--]</a> =======头部大导航模板(需要生产调用)
<ul>
[!--empirenews.listtemp--]
<!--list.var1-->
[!--empirenews.listtemp--]
</ul>
</li>
栏目链接 栏目名称
<li><a href="[!--classurl--]">[!--classname--]</a></li>
---------------------------------------------------------------
<style type="text/css"> =========这个是让背景图片居中显示
body {
background :url(beijing.jpg) no-repeat;
background-position-x:center;
}
body { text-align:center} =========这个是让div合作居中显示
#divcss5{margin:0 auto;border:1px solid #000;width:300px;height:100px}
</style>
——————————————————————
div居中:
margin: 0 auto;
text居中:
text-align:center;
------------------------------------------
英文最美观字体:Times New Roman
© L Design 2018 =====l设计
<div style="clear:both"></div> ==========清除浮动!
========空格代码
opacity: 0.6; =====透明度设置
border-radius:10px; =======圆角设置
-webkit-box-shadow: 2px 2px 8px #808080; ====外阴影
box-shadow:4px 4px 10px #afafaf inset; ====内阴影
text-shadow:0px 2px 0px #CCC,2px 2px 3px #666; ========字体阴影叠加
text-shadow:2px 2px 5px orange; =======字体阴影
overflow:hidden; =======超出框子自动隐藏
text-decoration:none; =======不要下划线
target="_blank" =======新窗口打开
<style>a{TEXT-DECORATION:none;}a:hover{TEXT-DECORATION:none;}</style> ====整个页面不要下划线
<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>=========显示路径
[!--onclick--] =======调用点击数!
<?=sub($navinfor[smalltext],0,205,false)?> =====php限制字符数,力标签页面用不起!
<div style="clear:both;"></div> ========div清除浮动!
background: linear-gradient(#ffffff, #e5e5e5) ======渐变色