chaihongjun.me

ALT自动用文章标题填充

1.打开文件Include/arc.archives.class.php

2.寻找代码:

$this->Fields['typename'] = $this->TypeLink->TypeInfos['typename']; 
@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives');

3.在以上代码后面添加代码:

//替换文章BODY Alt为文档标题 
$this->Fields['body'] = str_ireplace(array('alt=""','alt='''),'',$this->Fields['body']); 
$this->Fields['body'] = preg_replace("@ [s]{0,}alt[s]{0,}=["'s]{0,}[sS]{0,}["'s] @isU"," ",$this->Fields['body']); 
$this->Fields['body'] = str_ireplace("<img " ,"<img alt="".$this->Fields['title']."" ",$this->Fields['body']);


知识共享许可协议本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。作者:柴宏俊»