V9使用技巧合集.docx

上传人:b****7 文档编号:9623930 上传时间:2023-02-05 格式:DOCX 页数:20 大小:228.47KB
下载 相关 举报
V9使用技巧合集.docx_第1页
第1页 / 共20页
V9使用技巧合集.docx_第2页
第2页 / 共20页
V9使用技巧合集.docx_第3页
第3页 / 共20页
V9使用技巧合集.docx_第4页
第4页 / 共20页
V9使用技巧合集.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

V9使用技巧合集.docx

《V9使用技巧合集.docx》由会员分享,可在线阅读,更多相关《V9使用技巧合集.docx(20页珍藏版)》请在冰豆网上搜索。

V9使用技巧合集.docx

V9使用技巧合集

V9使用技巧合集

V9使用技巧合集

1、错误日志记录超过警戒设置,为避免影响性能,建议您及时清理

解决:

1.\caches\error_log.php

复制代码

2、碎片管理变量

解决:

1.{php$posid='fddasf_'.$catid;}

2.{pc:

blockpos="$posid"}{/pc}

复制代码

3、如何分开调用inputtime字段中的年、月、日

解决:

方案一:

管理员freshcn(杨争)的方案

  以内容页为例子。

如果你直接使用$inputtime  应该是被格式化过的一个结果。

如果你想要自己进行格式化,可以使用

1.{date('Y-m-dH:

i:

s',$rs['inputtime'])}

复制代码

前提是

1.Y是年的意思

2.m月

3.d天

4.H小时

5.i分

6.s秒

复制代码

date第一参数里面放多少,就会被格式化出来多少。

也就是说你要分开显示的话。

你就可以先

1.{date('Y',$rs[inputtime])}年{date('m',$rs[inputtime])}月{date('d',$rs[inputtime])}日

复制代码

方案二:

管理员rocing(我是大鹏)的方案

  可以直接使用php中date函数,$inputtime为你要转化的时间戳

1.年

2.date('Y',$inputtime);4位数字完整表示的年份例如:

1999或2003

3.date('y',$inputtime);2位数字表示的年份例如:

99或03

4.月

5.date('F',$inputtime);月份,完整的文本格式,例如January或者March

6.date('m',$inputtime);数字表示的月份,有前导零例如01到12

7.date('M',$inputtime);三个字母缩写表示的月份例如Jan到Dec

8.date('n',$inputtime);数字表示的月份,没有前导零例如1到12

9.日

10.date('d',$inputtime);月份中的第几天,有前导零的2位数字例如01到31

11.date('D',$inputtime);星期中的第几天,文本表示,3个字母例如Mon到Sun

12.date('j',$inputtime);月份中的第几天,没有前导零例如1到31

13.date('l',$inputtime);星期几,完整的文本格式例如Sunday到Saturday

14.date('N',$inputtime);ISO-8601格式数字表示的星期中的第几天(PHP5.1.0新加)例如1(表示星期一)到7(表示星期天)

复制代码

4、如何利用分类功能实现新闻列表前添加不同分类图标

解决:

1.{if$typeid=''}

2.

3.{/if}

复制代码

5、UCenter与PHPCMSV9整合

解决:

经测试一程序注册会员另一程序可正常登陆

phpcms登陆后discuz  可实现同步登陆

phpcms退出discuz可同步退出。

在phpcms中的phpsso配置ucenter如下图

在ucenter中添加应用如下图

6、V9二次开发,增加点评评论模块,独立模块,不影响升级,一键安装卸载,原码已经放出

解决:

点评特点:

不影响升级,独立模块,可审核点评,支持群站属性,根据模版调用不同点评信息(如考试,调用考试的,网校调整用网校的)

后台一键安装

前台模版修改方便

安装方法:

第一步:

把压缩包解压到你的文件根目录

第二步:

进入后台,模块——模块管理,就会看到

第三步:

点击安装(注意我的数据库前缀是默认V9_如果不是的话。

就要自己改动一下了)

第四步:

后台管理:

在模块——点评配置

第五步:

前台引用:

以默认show.html(内容页模版)为例

改动前:

{APP_PATH}index.php?

m=comment&c=index&a=init&commentid={id_encode("content_$catid",$id,$siteid)}&iframe=1

改动后:

{APP_PATH}index.php?

m=reviews&c=index&a=init&reviewsid={id_encode("content_$catid",$id,$siteid)}&iframe=1&star_type=1

变量解析:

如果iframe=1  读取show_list.html模版

否则读取  show_milist.html模版

star_type=1是点评的类型可以改动根目录下的star_config.php

点评模块_免费版.rar(31.1KB)

下载次数:

6

2010-11-1615:

40

7、万能字段(附:

使用教程)

解决:

使用方法:

1、首先建立万能字段,在万能字段“表单参数中输入:

{huxingshi}室{huxingting}厅{huxingwei}卫  第{floor}  层,总{zonglouceng}层”

2、需要和平常一样在添加新的字段huxingshi等等,在字段选项中选择  作为万能字段的附属字段

保存提交即可

8、解决V9缩略图模糊

解决:

1.

2./libs/classes/image.class.php

3.注释掉

4.else

5.  imagecopyresized($thumbimg,$srcimg,0,0,$psrc_x,$psrc_y,$width,$height,  $srcwidth,$srcheight);

6.另将102行的

7.$imagefun($thumbimg,$filename);

8.修改为

9.$imagefun($thumbimg,$filename,90);

10.

11.90就是图片质量值,越大越清

复制代码

9、漂亮的评论评分模块

解决:

建立v9_star表

1.CREATETABLE`v9_star`(

2.`id`MEDIUMINT(8)UNSIGNEDNOTNULLAUTO_INCREMENT,

3.`contentid`MEDIUMINT(8)UNSIGNEDNOTNULL,

4.`commentid`INT(10)UNSIGNEDNOTNULLDEFAULT'0',

5.`catid`SMALLINT(5)UNSIGNEDNOTNULL,

6.`star1`TINYINT

(1)UNSIGNEDNOTNULLDEFAULT'0',

7.`star2`TINYINT

(1)UNSIGNEDNOTNULLDEFAULT'0',

8.`star3`TINYINT

(1)UNSIGNEDNOTNULLDEFAULT'0',

9.`star4`TINYINT

(1)UNSIGNEDNOTNULLDEFAULT'0',

10.`star5`TINYINT

(1)UNSIGNEDNOTNULLDEFAULT'0',

11.`allstar`TINYINT

(1)UNSIGNEDNOTNULLDEFAULT'0',

12.`allstars`TINYINT

(1)UNSIGNEDNOTNULLDEFAULT'0',

13.`average`FLOAT(3,2)NOTNULLDEFAULT'0.00',

14.`type`TINYINT

(1)UNSIGNEDNOTNULLDEFAULT'0',

15.`ip`CHAR(15)CHARACTERSETgbkCOLLATEgbk_chinese_ciNOTNULL,

16.`userid`MEDIUMINT(8)UNSIGNEDNOTNULL,

17.`addtime`INT(10)UNSIGNEDNOTNULLDEFAULT'0',

18.PRIMARYKEY(`id`),

19.INDEX(`contentid`,`commentid`,`catid`,`ip`)

20.)ENGINE=MYISAMCHARACTERSETgbkCOLLATEgbk_chinese_ci

复制代码

有选择性的在某个模型使用

1.{APP_PATH}index.php?

m=comment&c=index&a=init&commentid={id_encode("content_$catid",$id,$siteid)}&iframe=1

复制代码

改成

1.{APP_PATH}index.php?

m=comment&c=index&a=init&commentid={id_encode("content_$catid",$id,$siteid)}&iframe=1&modelid={$modelid}

复制代码

演示截图:

下载(65.45KB)

2010-11-1615:

55

评分插件.zip(13.34KB)

下载次数:

9

2010-11-1615:

56

10、标题后面的“…”如何删除?

解决:

1.

2.{str_cut($v['title'],28)}修改为{str_cut($v['title'],28,"")}

复制代码

11、摘要空格变字符的问题

解决:

1.

2.{str_cut(strip_tags($v['content']),38)}这样写就不会有 了

复制代码

12、v9_sso_session数据表自动删除

解决:

v9后台的phpsso管理出问题了,不能登录了

MySQLQuery:

MySQLError:

Table'jinhua_liuying.v9_sso_session'doesn'texist

MySQLErrno:

1146

Message:

Table'jinhua_liuying.v9_sso_session'doesn'texist

把以前备份过的sql数据打开,凡是前缀为v9_sso_的数据全部拷贝到当前数据

即可解决此问题

13、v9采集规则一例

解决:

采集自新浪国内新闻.经过测试,可以正常采集.特分享一下.需要了解规则的也可以导入后查看

pc_collection_1.zip(1.13KB)

下载次数:

8

2010-11-1616:

08

2010年11月12日20:

51:

24最新更新:

分页采集方法:

pc_collection_2.zip(894Bytes)

下载次数:

8

2010-11-1616:

09

可以正常采集分页,测试通过.

有些同志不能采集的,建议分析下这个规则里的过滤选项.

过滤选项不要限制过死,过小.不建议直接过滤任何标签,否则如果目标站嵌套了你就啥也采集不到了.

比如:

]*)>[|]

[|]

这是标准的过滤a标签的,系统自带的过滤a标签:

]*)>(.*)[|]  会把a中间的内容也过滤掉.这是不好的.

内容匹配规则,不可指定常用标签比如div,p等.而应该宽泛点,如:

[内容]

这样的.此规则原作者指定以

标签结束,是不对的.限制太大

14、如何调用出会员自定义模型的字段

解决:

如果只输出值

1.

2.{pc:

getsql="SELECT*FROMphpcms_member"cache="3600"page="$page"dbsource=""return="data"}

3.

4.

    5.

    6.{loop$data$key$val}

    7.

    8.{$val[username]}

    9.

    10.{/loop}

    11.

    12.

13.

14.{$pages}

15.

16.{/pc}

复制代码

如果要输出联动菜单、box、日期字段、等特殊字段,需要做一下处理。

      1.直接输出参见:

phpcms/modules/member/index.php中的account_manage方法

      2.带编辑框输出参见:

phpcms/modules/member/index.php中的account_manage_info方法

15、实现v9内容页url规则增加汉字拼音功能

解决:

效果如下:

当你的内容标题为绿色软件时,链接地址里将带上lvseruanjian.

实现过程:

修改modules/content/classes/url.class.php文件的publicfunctionshow()  函数为如下代码:

1.publicfunctionshow($id,$page=0,$catid=0,$time=0,$prefix='',$data='',$action='edit'){

2.$page=max($page,1);

3.$urls=$catdir='';

4.$category=$this->categorys[$catid];

5.$setting=string2array($category['setting']);

6.$content_ishtml=$setting['content_ishtml'];

7.$show_ruleid=$setting['show_ruleid'];

8.$urlrules=$this->urlrules[$show_ruleid];

9.if(!

$time)$time=SYS_TIME;

10.$urlrules_arr=explode('|',$urlrules);

11.if($page==1){

12.$urlrule=$urlrules_arr[0];

13.}else{

14.$urlrule=$urlrules_arr[1];

15.}

16.if(strpos($category['url'],':

//')!

==false&&strpos($category['url'],'?

')===false){

17.if(preg_match('/^((http|https):

\/\/)?

([^\/]+)/i',$category['url'],$matches)){

18.$url=$matches[0].'/';

19.}

20.$db=pc_base:

:

load_model('category_model');

21.$r=$db->get_one(array('url'=>$url),'`catid`');

22.$domain_dir=$this->get_categorydir($r['catid']).$this->categorys[$r['catid']]['catdir'].'/';

23.}

24.$categorydir=$this->get_categorydir($catid);

25.$catdir=$category['catdir'];

26.$year=date('Y',$time);

27.$month=date('m',$time);

28.$day=date('d',$time);

29.//add2010年10月29日23:

49:

06化蝶自在飞标题转化为拼音感谢站长支持.

30.pc_base:

:

load_sys_func('iconv');

31.$modelid=$category['modelid'];

32.if(!

$modelid)return'';

33.$db=pc_base:

:

load_model('content_model');

34.$db->set_model($modelid);

35.$r=$db->get_one(array('id'=>$id),'`title`');

36.$pinyin=gbk_to_pinyin($r['title']);

37.if(is_array($pinyin)){

38.$pinyin=implode('',$pinyin);

39.}

40.//end

41.$urls=str_replace(array('{$categorydir}','{$catdir}','{$year}','{$month}','{$day}','{$catid}','{$id}','{$page}','{$pinyin}'),array($categorydir,$catdir,$year,$month,$day,$catid,$id,$page,$pinyin),$urlrule);

42.$create_to_html_root=$category['create_to_html_root'];

43.if(preg_match("/^(http:

\/\/)?

([^\/]+)/i",$category['url'],$_match)){

44.if($category['parentid']&&$_match[0]){

45.foreach($this->categorysas$_key=>$_value){

46.if($_value['create_to_html_root']&&$_value['url']==$_match[0].'/')$create_to_html_root=1;

47.}

48.}

49.}

50.

51.if($create_to_html_root){

52.$html_root='';

53.}else{

54.$html_root=$this->html_root;

55.}

56.

57.if($content_ishtml&&$url){

58.if(strpos($urls,$domain_dir)!

==false){

59.$url_arr[1]=$html_root.'/'.$urls;

60.$url_arr[0]=str_replace($domain_dir,$url,$urls);

61.}else{

62.$url_arr[1]=$html_root.'/'.$domain_dir.$urls;

63.$url_arr[0]=WEB_PATH=='/'?

$url.$urls:

substr(WEB_PATH,0,-1).$url.$urls;

64.}

65.}elseif($content_ishtml){

66.$url_arr[0]=WEB_PATH=='/'?

$html_root.'/'.$urls:

substr(WEB_PATH,0,-1).$html_root.'/'.$urls;

67.$url_arr[1]=$html_root.'/'.$urls;

68.}else{

69.$url_arr[0]=$url_arr[1]=APP_PATH.$urls;

70.}

71.//生成静态,在添加文章的时候,同时生成静态,不在批量更新URL处调用

72.if($content_ishtml&&$data){

73.$html=pc_base:

:

load_app_class('html','content');

74.$data['id']=$id;

75.$html->show($url_arr[1],$data);

76.//在添加和修改内容处定义了INDEX_HTML

77.if(defined('INDEX_HTML'))$html->index();

78.if(defined('RELATION_HTML'))$html->create_relation_html($catid);

79.}

80.

81.return$url_arr;

82.}

复制代码

注意是整个函数替换掉.这个函数是昨天的最新版本.不想替换的可以自己对比和原来函数,只是增加了一段代码.

然后就可以在url规则里使用{$pinyin}这个url标志了.注意是内容规则(show),不适用栏目url

16、shtml设置如何设置

解决:

1.

2.修改url规则的.html变成.shtml

3.如果你是为静态的就要修改.htaccess文件

4.RewriteRule^index.shtmlindex.php

5.RewriteRule^content-([0-9]+)-([0-9]+)-([0-9]+).shtmlindex.php?

m=content&c=index&a=show&catid=$1&id=$2&page=$3

6.

7.RewriteRule^show-([0-9]+)-([0-9]+)-([0-9]+).shtmlindex.php?

m=content&c=index&a=show&catid=$1&id=$2&page=$3

8.RewriteRule^pic-([0-9]+)-([0-9]+)-([0-9]+).shtmlindex.php?

m=content&c=index&a=show&catid=$1&id=$2&page=$3

9.

10.RewriteRule^down-([0-9]+)-([0-9]+)-([0-9]+).shtmlindex.php?

m=content&c=index&a=show&catid=$1&id=$2&

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 经济学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1