VIP福利
主页 > 建站问题 > 织梦DEDECMS实现图片ALT属性自动换成标题

织梦DEDECMS实现图片ALT属性自动换成标题

第一步,\include\taglib\channel\img.lib.php文件,第77行左右,加上 $dsql= new DedeSql(false);//建立新连接 $rs = $dsql-GetOne("Select title from cmsxx_archives where"); //打开数据库 $title=$rs["title"]; //找到标题值 第107行左右 加一句 $field […]



第一步,\include\taglib\channel\img.lib.php文件,第77行左右,加上

$dsql= new DedeSql(false);//建立新连接 
$rs = $dsql->GetOne("Select title from cmsxx_archives where");  //打开数据库 
$title=$rs["title"];  //找到标题值

第107行左右
加一句

$fields['title'] = str_replace("'",'',$title); 

我说左右因为是同类语句中放哪都行。

第二步,把article_image.htm中的

alt='[field:alttext /]' 

换为:

alt='[field:title /]' 

第三步,生成,搞定


说点什么吧
  • 全部评论(0
    还没有评论,快来抢沙发吧!