Dedecms圖片加上Alt和Title等屬性的修改方法
發(fā)布時(shí)間:2013-01-22 16:02:53 作者:佚名
我要評(píng)論

Dedecms發(fā)表資訊等等上傳的圖片全部沒有title,雖然有這個(gè)選項(xiàng)卻不生效,于是就研究了一下,發(fā)現(xiàn)只需要在相關(guān)文件添加一段代碼即可。先告知大家方法,希望更多的人能夠受益
找到include文件夾下面的arc.archives.class.php文件,打開,記得不能用記事本打開,可以在dedecms后臺(tái)文件管理里面打開或者notepad++等軟件打開。
找到下面這段代碼:
//設(shè)置全局環(huán)境變量
$this->Fields['typename'] = $this->TypeLink->TypeInfos['typename'];
@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives');
}
//完成附加表信息讀取
unset($row);
大概在第204行。
然后在
@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives');
下面添加:
$this->Fields['body'] = str_ireplace("<img " ,"<img alt='".$this->Fields['title'].",腳本之家' ",$this->Fields['body']);
$this->Fields['imgurls'] = str_ireplace("<img " ,"<img alt='".$this->Fields['title'].",腳本之家' ",$this->Fields['imgurls']);
$this->Fields['introduce'] = str_ireplace("<img " ,"<img alt='".$this->Fields['title'].",腳本之家' ",$this->Fields['introduce']);
其中的“腳本之家”可以更換成你想要更換的文字。
找到下面這段代碼:
復(fù)制代碼
代碼如下://設(shè)置全局環(huán)境變量
$this->Fields['typename'] = $this->TypeLink->TypeInfos['typename'];
@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives');
}
//完成附加表信息讀取
unset($row);
大概在第204行。
然后在
復(fù)制代碼
代碼如下:@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives');
下面添加:
復(fù)制代碼
代碼如下:$this->Fields['body'] = str_ireplace("<img " ,"<img alt='".$this->Fields['title'].",腳本之家' ",$this->Fields['body']);
$this->Fields['imgurls'] = str_ireplace("<img " ,"<img alt='".$this->Fields['title'].",腳本之家' ",$this->Fields['imgurls']);
$this->Fields['introduce'] = str_ireplace("<img " ,"<img alt='".$this->Fields['title'].",腳本之家' ",$this->Fields['introduce']);
其中的“腳本之家”可以更換成你想要更換的文字。
相關(guān)文章
HTMLimg標(biāo)簽的alt屬性和title屬性使用介紹
HTML的img標(biāo)簽:alt屬性和title屬性,很多人看來對(duì)這兩個(gè)屬性感到迷惑,所以我寫下我的想法,如何去用它們2014-02-20- DEDE_V5.3 實(shí)現(xiàn)給內(nèi)容中的圖片添加標(biāo)題ALt標(biāo)記織夢(mèng)優(yōu)秀網(wǎng),發(fā)單接單,優(yōu)秀的任務(wù)平臺(tái)!程序版本:V5.3X 修改文件:Include/ arc.archives.class.php 修改方法:2009-06-07
- XHTML是CSS布局的基礎(chǔ),webjx.com一直強(qiáng)調(diào)XHTML知識(shí)的學(xué)習(xí),重視語義和文檔的結(jié)構(gòu)。title 和alt 屬性,給我最直觀的感受就是,可以提高文檔的適應(yīng)性,并合理提高關(guān)鍵詞密度2009-04-02
- 下面小編就為大家?guī)硪黄P(guān)于alt和title的用法區(qū)別詳解。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-06-08