今天在做一个站时用到了自定义模型,遇到了些问题,在更新列表页时提示:
Fatal error: Call to a member function GetInnerText() on a non-object in E:\www\include\taglib\channel\img.lib.php on line 51
这个错误提示会在更新自定义模型栏目列表的时候出现,修复此问题方法很简单。
编辑打开 /inculde/taglib/channel/img.lib.php
找到51行所在的代码,将其替换为
$innerTmp = ($arcTag=="") ? trim($arcTag) : trim($arcTag->GetInnerText());
保存即可。
然后列表页就正常了。
源代码:
- <?php
- if(!defined('DEDEINC'))
- {
- exit( "Request Error!");
- }
- /**
- * 图像标签
- *
- * @version $Id:img.lib.php 1 9:33 2010年7月8日Z tianya $
- * @package DedeCMS.Taglib
- * @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
- * @license http://help.dedecms.com/usersguide/license.html
- * @link http://www.dedecms.com
- */
- function ch_img($fvalue,&$arcTag,&$refObj,$fname='')
- {
- global $cfg_album_width,$cfg_album_row,$cfg_album_col,$cfg_album_pagesize,$cfg_album_style,$cfg_album_ddwidth,$cfg_basehost,$cfg_multi_site;
- $dtp = new DedeTagParse();
- $dtp- >LoadSource($fvalue);
- if(!is_array($dtp- >CTags))
- {
- $dtp- >Clear();
- return "无图片信息!";
- }
- $pagestyle = $cfg_album_style;
- $maxwidth = $cfg_album_width;
- $ddmaxwidth = $cfg_album_ddwidth;
- $pagepicnum = $cfg_album_pagesize;
- $row = $cfg_album_row;
- $icol = $cfg_album_col;
- $ptag = $dtp- >GetTag('pagestyle');
- if(is_object($ptag))
- {
- $pagestyle = $ptag- >GetAtt('value');
- $maxwidth = $ptag- >GetAtt('maxwidth');
- $ddmaxwidth = $ptag- >GetAtt('ddmaxwidth');
- $pagepicnum = $ptag- >GetAtt('pagepicnum');
- $irow = $ptag- >GetAtt('row');
- $icol = $ptag- >GetAtt('col');
- if(emptyempty($maxwidth))
- {
- $maxwidth = $cfg_album_width;
- }
- }
- //遍历图片信息
- $mrow = 0;
- $mcol = 0;
- $images = array();
- $innerTmp = $arcTag- >GetInnerText();
- if(trim($innerTmp)=='')
- {
- $innerTmp = GetSysTemplets( "channel_article_image.htm");
- }
- if($pagestyle==1)
- {
- $pagesize = $pagepicnum;
- }
- else if($pagestyle==2)
- {
- $pagesize = 1;
- }
- else
- {
- $pagesize = $irow * $icol;
- }
- if(is_object($arcTag) && $arcTag->GetAtt('pagesize') > 0)
- {
- $pagesize = $arcTag- >GetAtt('pagesize');
- }
- if(emptyempty($pagesize))
- {
- $pagesize = 12;
- }
- $aid = $refObj- >ArcID;
- $row = $refObj- >dsql->GetOne("SELECT title FROM `ddmx_archives` WHERE `id` = '$aid';");
- $title = $row['title'];
- $revalue = '';
- $GLOBAL['photoid'] = 0;
- foreach($dtp- >CTags as $ctag)
- {
- if($ctag- >GetName()=="img")
- {
- $fields = $ctag- >CAttribute->Items;
- $fields['text'] = str_replace( "'","",$ctag->GetAtt('text'));
- $fields['title'] = $title;
- $fields['imgsrc'] = trim($ctag- >GetInnerText());
- $fields['imgsrctrue'] = $fields['imgsrc'];
- if(emptyempty($fields['ddimg']))
- {
- $fields['ddimg'] = $fields['imgsrc'];
- }
- if($cfg_multi_site=='Y')
- {
- //$cfg_basehost)
- if( !preg_match('#^http:#i', $fields['imgsrc']) ) {
- $fields['imgsrc'] = $cfg_basehost.$fields['imgsrc'];
- }
- if( !preg_match('#^http:#i', $fields['ddimg']) ) {
- $fields['ddimg'] = $cfg_basehost.$fields['ddimg'];
- }
- }
- if(emptyempty($fields['width']))
- {
- $fields['width'] = $maxwidth;
- }
- //if($fields['text']=='')
- //{
- //$fields['text'] = '图片'.($GLOBAL['photoid']+1);
- /
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!