小米技术社区
小米技术社区管理员 关于小米

27岁,山西运城人,职业电商经理人,前端开发工作者,从事过网站建设、网络推广、SEO、SEM、信息流推广、二类电商、网络运维、软件开发,等相关电商工作,经验较为丰富,小米技术社区致力于为广大从事Web前端开发的人员提供一些力所能及的引导和帮助 ...[更多]

E-mail:mzze@163.com

Q Q:32362389

W X:xiaomi168527

小米技术社区大牛王飞 关于王飞

27岁,山西运城人,职业电商经理人,网络工程师兼运维,从事过运营商网络建设,企业网络建设、优化。数据中心网络维护等通过,经验丰富,座右铭:当自己休息的时候,别忘了别人还在奔跑。 ...[更多]

E-mail:wf_live@126.com

Q Q:3940019

微博:王小贱ss

小米技术社区设计小艳 关于小艳

大于花一样的年龄,河南郑州是我家,2010年在北京接触团购网,2011年进入天猫淘宝一待就是四年,如今已经将设计走向国际化(ps:误打误撞开始进入阿里巴巴国际站的设计,嘿嘿)五年电商设计,丰富经验,从事过天猫淘宝阿里各项设计,店铺运营,产品拍摄;我将我的经历与您分享是我的快乐!座右铭:越努力越幸运! ...[更多]

E-mail:97157726@qq.com

Q Q:97157726

标签云
精品推荐
  • 帝国cms安全性防护-防患于未然

    帝国cms安全性防护-防患于未然

    帝国cms安全防护主要从以下几个方面来1.如果是展示站点,用不到个人空间,删除e/space文件,并在后台关闭会员注册,并开启验证码,提升安全性严重性:不法分子通过注册账号,在e/s……
    271人已经看过了
  • 帝国cms随机调用信息

    帝国cms随机调用信息

    我们知道,帝国cms随机调用标签是[ecmsinfo]1,5,32,0,0,2,0,”,’rand()’[/ecmsinfo]但是这种调用方式在数据量特别大的时候严重影响生成速度,对于中大型网站不建议使用 我们……
    2825人已经看过了
  • 帝国cms分页列表样式

    帝国cms分页列表样式

    <div class="pagelist">[!--show.listpage--]</div>css/*pagelist*/.pagelist{ text-align:center; overflow: hidden; margin-top:60px; clear: both;}.pageli……
    1777人已经看过了
  • 帝国cms灵动标签用法

    帝国cms灵动标签用法

    1、标题+简介示例:[e:loop={2,1,0,0}] <h1><a href="<?=$bqsr[titleurl]?>" target="_blank" title="<?=$bqr[title]?>"> <?=esub($bqr[title],36)?> </a></h1><p><?=esub($b……
    306人已经看过了
  • 帝国常用标签汇总

    帝国常用标签汇总

    帝国CMS内容页模版如何调用当前栏目名称和链接 <a href="<?=sys_ReturnBqClassname($navinfor,9)?>/">[!--class.name--]</a>……
    293人已经看过了
您的位置:首页 > CMS > 帝国CMS

帝国cms的图集调用方法,utf-8和gb2312版本

分类: 帝国CMS25个赞
1、将userfun.php中的代码,复制到你的e/class/userfun.php中

代码见文章底部


2、到后台“模板”中的“标签”栏目下


添加标签:


标签名:图集
标签符号:pichd
函数名:user_PhotoMorepic
标签格式:[pichd]tempid[/pichd]
其他为空即可


tempid为模板标签id


3、到后台“模板”中的“标签模板”栏目下


添加标签模板:

================


页面模板内容:

================


[!--empirenews.listtemp--]
<!--list.var1-->
[!--empirenews.listtemp--]


列表内容模板(list.var):

================


<li>
<img src="[!--smallpic--]" alt="[!--picname--]" />
</li>
=======变量说明=========
[!--picname--] 图片说明(标题)
[!--smallpic--]小图
[!--bigpic--]大图
[!--no.num--]序号



================

4、到你的需要显示的内容模板里,放上以上调用:

[pichd]标签模板id[/pichd]


注:这里的“标签模板id”可以查看后台的“模板”--“标签模板”中的ID数是多少,即填多少。




5、到后台去刷新所有页面即可,好了,到这里已经全部完成了,过程都在这里了,非常详细的了。为了大家都能


非常快的上手,特写以上步骤。



注:一开始我是不明天“标签”与“标签模板”是如何关联起来的,后来查看到[pichd]标签模板id[/pichd]这里


才明白,原来是通过这里的“标签模板id”关联的。



userfun.php的utf-8和gbk有区别,主要在5.4以上的版本,5.2以下的都用utf-8就可以

因为在5.4后

htmlspecialchars原来是ISO-8859-1,5.4后默认变成utf-8!然后中文gbk使用这个函数就输出为空白了。

主要在htmlspecialchars这里有区别



utf-8版本

<?php
//---------------------------用户自定义标签函数文件
function user_PhotoMorepic($tempid){
	global $navinfor,$public_r;
	$morepic=$navinfor['morepic'];
	$rexp="\r\n";
	$fexp="::::::";
	$rstr="";
	$sdh="";
	$w_morepic="";
	$rr=explode($rexp,$morepic);
	$count=count($rr);
	$num=$count;
	
	//取得模板
	$tr=sys_ReturnBqTemp($tempid);
	if(empty($tr['tempid']))
	{return "";}
	$listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
	$subnews=$tr[subnews];
	$listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
	$rownum=$tr[rownum];
	$formatdate=$tr[showdate];
	if(empty($rownum))
	{$rownum=1;}
	
	
	//列表
	$list_exp="[!--empirenews.listtemp--]";
	$list_r=explode($list_exp,$listtemp);
	$listtext=$list_r[1];
	$no=1;
	$changerow=1;
	
	for($i=0;$i<$count;$i++)
	{
		
		$fr=explode($fexp,$rr[$i]);
	
		$smallpic=$fr[0]?$fr[0]:$public_r[newsurl]."e/data/images/notimg.gif";	//小图
		$bigpic=$fr[1]?$fr[1]:$public_r[newsurl]."e/data/images/notimg.gif";	//大图
		if(empty($bigpic))
		{
			$bigpic=$smallpic;
		}
		$picname=htmlspecialchars($fr[2]);	//名称
		$val[picname]=$picname;
		$val[bigpic]=$bigpic;
		$val[smallpic]=$smallpic;
		/////////////////
		$strF=",picname,bigpic,smallpic,";
		$repvar=user_ReplaceShowpicsVars($listvar,$strF,$val,$no);
		$listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
		$changerow+=1;
		//超过行数
		if($changerow>$rownum)
		{
		$changerow=1;
		$string.=$listtext;
		$listtext=$list_r[1];
		}
		$no++;
			
	}
   $string=$list_r[0].$string.$list_r[2];
	echo $string;
}

function user_ReplaceShowpicsVars($listtemp,$strF,$val,$no){
$fr=explode(',',$strF);
$fcount=count($fr)-1;;
for($i=1;$i<$fcount;$i++)
{
$f=$fr[$i];
$value=$val[$f];
$listtemp=str_replace('[!--'.$f.'--]',$value,$listtemp);
}
$listtemp=str_replace('[!--no.num--]',$no,$listtemp);

return $listtemp;
}



?>

gbk或gb2312版本

<?php
//---------------------------用户自定义标签函数文件
function user_PhotoMorepic($tempid){
	global $navinfor,$public_r;
	$morepic=$navinfor['morepic'];
	$rexp="\r\n";
	$fexp="::::::";
	$rstr="";
	$sdh="";
	$w_morepic="";
	$rr=explode($rexp,$morepic);
	$count=count($rr);
	$num=$count;
	
	//取得模板
	$tr=sys_ReturnBqTemp($tempid);
	if(empty($tr['tempid']))
	{return "";}
	$listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
	$subnews=$tr[subnews];
	$listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
	$rownum=$tr[rownum];
	$formatdate=$tr[showdate];
	if(empty($rownum))
	{$rownum=1;}
	
	
	//列表
	$list_exp="[!--empirenews.listtemp--]";
	$list_r=explode($list_exp,$listtemp);
	$listtext=$list_r[1];
	$no=1;
	$changerow=1;
	
	for($i=0;$i<$count;$i++)
	{
		
		$fr=explode($fexp,$rr[$i]);
	
		$smallpic=$fr[0]?$fr[0]:$public_r[newsurl]."e/data/images/notimg.gif";	//小图
		$bigpic=$fr[1]?$fr[1]:$public_r[newsurl]."e/data/images/notimg.gif";	//大图
		if(empty($bigpic))
		{
			$bigpic=$smallpic;
		}
		$picname=htmlspecialchars($fr[2],ENT_COMPAT,'GB2312');	//名称
		$val[picname]=$picname;
		$val[bigpic]=$bigpic;
		$val[smallpic]=$smallpic;
		/////////////////
		$strF=",picname,bigpic,smallpic,";
		$repvar=user_ReplaceShowpicsVars($listvar,$strF,$val,$no);
		$listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
		$changerow+=1;
		//超过行数
		if($changerow>$rownum)
		{
		$changerow=1;
		$string.=$listtext;
		$listtext=$list_r[1];
		}
		$no++;
			
	}
   $string=$list_r[0].$string.$list_r[2];
	echo $string;
}

function user_ReplaceShowpicsVars($listtemp,$strF,$val,$no){
$fr=explode(',',$strF);
$fcount=count($fr)-1;;
for($i=1;$i<$fcount;$i++)
{
$f=$fr[$i];
$value=$val[$f];
$listtemp=str_replace('[!--'.$f.'--]',$value,$listtemp);
}
$listtemp=str_replace('[!--no.num--]',$no,$listtemp);

return $listtemp;
}



?>


小米技术社区

本站内容均为小米原创,转载请注明出处:小米技术社区>> 帝国cms的图集调用方法,utf-8和gb2312版本