常用代码片段

网页灰色:
<style>
html{overflow-y:scroll;filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);-webkit-filter: grayscale(100%);}
</style>
 
<A href="#">设为首页</A><A >
 
css等比缩放图片
height: expression(this.width > 300 ? this.height = this.height * 300 / this.width : "auto");
width: expression(this.width > 300 ? "300px" : "auto");max-width:300px;
 
div高度自动延伸
在Div末尾加入代码:
<div style="clear:both;"></div>
 
phpcms获取单个栏目
{$CATEGORYS[3]['catname']}
{$CATEGORYS[3]['url']}
{str_cut($r[description],112,'...')}
 
第一种、直接写子栏目id ,用cat in
{pc:get sql="SELECT * from v9_news where status=99 and catid in(21,22,23,24,25) order by id DESC" num="7" return="data"}
{loop $data $r}
 
{str_cut($r['title'],40)}({date('m-d',$r[inputtime])})<<img src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/)A[Y)I~](ZC9Z[3Y)IDK7LK.gif">>
{/loop}
{/pc}
 
比如调用id为8 的文章
 
{pc:get sql="SELECT * FROM gxbc_news WHERE id=8" return="data" }
{loop $data $r}
<h1><a href="{$r[url]}" title="{$r[title]}" target="_blank">{str_cut($r[title],33,'')}</a></h1>{/loop} {/pc}
 
phpcms 列表编号
<LI><I {if $n=="1" || $n=="2" || $n=="3"}class=rose{/if}>{$n}.</I><a href="{$r['url']}" title="{$r['title']}">{str_cut($r[title],26,'')}</a></LI>
 
phpcms 绝对路径
phpcms\modules\admin\templates\site_edit.tpl.php 11行 注释掉
phpcms\modules\admin\templates\site_edit.tpl.php 13行 注释掉
phpcms\modules\admin\site.php 129行 注释掉
 
phpcms v9 首页调用单页内容方法介绍
{pc:get sql="SELECT * FROM v9_page where catid=所要调用的catid号"}
{loop $data $key $val}
{str_cut(strip_tags($val[content]),400,"")}...
{/loop}
{/pc}
 
js添加html
for (var i = 0; i < names.length; i++) {
$("#show-img-name").append($("<div></div>").html($("<a></a>").html(names[i]).attr("href", "/upload/image/" + names[i] + "").attr("target", "_blank")));
}

猜你喜欢

转载自www.cnblogs.com/lezuw/p/12059787.html