XiaoCMS 是一款十分精简的小CMS,
我用它做了不少的小网站,效果还不错!
其中有些函数和常用代码分享出来!
截取字符:{xiao:function.strcut($xiao[title],20)} 日期函数:{xiao:function.date("Y-m-d", $xiao['time'])} 去除HTML代码的函数: {xiao:function.htmlspecialchars_decode($xiao['zidingyi'])} 1、字符串截断函数strcut {xiao:function.strcut($xiao[title],34)} 取title字段的前34个字符 2、显示图片image {xiao:function.image($xiao[thumb])} 3、显示缩略图thumb {xiao:function.thumb($xiao[thumb],100,100)} 比image函数多出来的两个参数含义分别为缩略图的宽度和高度 4、格式化时间 {xiao:function.date("Y-m-d", $xiao['time'])} 将时间格式化成“Y-m-d”的格式 5、面包屑地址position {xiao:function.position($catid, ' >> ')} 在单页、列表页或详情页中使用,显示当前内容的栏目名称、子栏目名称、最终结点名称 6、ajax调用函数url {xiao:function.url('api/hits',array('id'=>$id))} 这里是一个调用的例子,用于获取当前的内容的点击次数。 时间转换成时间戳:<?php echo -"2011-6-8 22:22:22"); ?> 多图调用: {xiao:loop $xindeziduan[fileurl] $key=>$t} {xiao:$xindeziduan[fileurl][$key]} <br/>{xiao:$xindeziduan[filename][$key]} 名称地址一起调用 {/xiao:loop} 多个参数条件 {xiao:php $pr = array(5,10,11,12,13,14,15,16,17,18,3,8,9);} <li class="nLi {xiao:if in_array($catid,$pr)}on{xiao:else}11{/xiao:if}"><a href="{xiao:$site_url}index.php?catid=5"> Applications </a> 多文件上传前台调用 {xiao:loop $tuji[file] $t} <div id=image_xixi-07 class=image><a href="http://www.lanrentuku.com/" target=_blank><IMG alt="" src="{xiao:$t}" width=772 height=434></a> <!-- <div class=word> <H3>{xiao:$tuji[filename][$key]}</H3> </div>--> </div> {/xiao:loop} //多图片 {xiao:loop $xindeziduan[fileurl] $key=>$t} {xiao:$xindeziduan[fileurl][$key]} <br/>{xiao:$xindeziduan[filename][$key]} 名称地址一起调用 {/xiao:loop} 判断余数 是否换行 class=" {xiao:if $key%4==0}listbox{xiao:else}listbox mr20{/xiao:if} " 时间判断: {xiao:list catid=8 num=1 cache=0 } <li><a href="{xiao:$xiao['url']}" title="{xiao:$xiao['title']}">{xiao:function.strcut($xiao[title],60)}{xiao:if time()-$xiao['time']<86400}<img src="{xiao:$site_template}images/new.gif">{/xiao:if}</a></li> {/xiao:list} {xiao:if $xiao['time']>(time()-3600*24*3)} {/xiao:if} sql 直接sql 统计 例如 list sql=SELECT MAX( id ) FROM `#xiaocms_content` 是文章总数 content改成你自己的表 #xiaocms_是表前缀 sql本月数据范围 DATE_FORMAT( FROM_UNIXTIME( tbegin ) , '%Y-%m' ) = DATE_FORMAT( NOW( ) , '%Y-%m' ) DATE_FORMAT( FROM_UNIXTIME( inputtime) , '%H:%i' ) > '14:00' AND DATE_FORMAT( FROM_UNIXTIME( inputtime) , '%H:%i' ) < '18:00' 自动增长 alter table qk_form_1_huibao change id id int(11) not null AUTO_INCREMENT; 清楚数据库;TRUNCATE TABLE qk_form_1_zichan tif用jpg替换 UPDATE picform_1_images SET `imagfiles`=REPLACE(`imagfiles`,'tif','jpg'); UPDATE `picform_1_images` SET `imagfiles`=REPLACE(`imagfiles`,'p-','jf-') WHERE picid like 'jf-%' //PHP_EOL 换行符 $select = explode(PHP_EOL, $c['content']); php 分割: $array = explode(",",$string); js代码转换 json_encode()就是将PHP数组转换成Json。相反,json_decode()就是将Json转换成PHP数组。 这个不是json,中间是分号而不是逗号,是用serialize转化的可储存值,用unserialize转化为数组。 $array = array(0 => "Eric", 1 => 23); echo json_encode($array); 程序将打印出 :["Eric",23] serialize() 把变量和它们的值编码成文本形式 unserialize() 恢复原先变量 $s1='Mon-Tue-Wed-Thu-Fri'; $days_array=explode('-',$s1); $days_array 变量现在是一个有5个元素的数组,其元素 Mon 的索引为0,Tue 的索引为1,等等。 $s2=implode(',',$days_array); 把数据组成一个新的变量 $idbuarray= $this->model('linkage')->where("parentid=149")->select(); $ar=array(); foreach ($idbuarray as $t) { $ar[]=$t['id']; } // print_r($ar); JS 确认对话框 放在herf=“”内 javascript:if(confirm('确实要删除吗?'))location='{xiao:function.url('news/huishou/', array('id'=>$t['id']))}'
分类: 程序开发 /
游客3337
Ubiquitylation conducts NOTCH into an early endosome, identified by the colocalization of the monomeric GTPase RAB5, and, if no further modifications occur, this is followed by its destruction in the lysosomal compartment recognized by association of RAB7 <a href=https://cialis.lat/discover-the-best-prices-for-cialis>cheap cialis generic online</a>
Reply