| @@ -61,14 +61,17 @@ function obtainalt($newalt) | |||||
| global $dsql, $id, $aid; | global $dsql, $id, $aid; | ||||
| $myid = isset($id) ? $id : $aid; | $myid = isset($id) ? $id : $aid; | ||||
| $row = $dsql->GetOne("SELECT title FROM `#@__archives` WHERE id='$myid'"); | $row = $dsql->GetOne("SELECT title FROM `#@__archives` WHERE id='$myid'"); | ||||
| //图片注释自动为标题 | |||||
| $newalt = str_ireplace(array('alt=""', 'alt=\'\'', 'title=""', 'title=\'\''), "", $newalt); | |||||
| $newalt = str_ireplace("<img", "<img alt=\"".$row['title']."\" title=\"".$row['title']."\"", $newalt); | |||||
| //去掉图片宽度和高度 | |||||
| $newalt = preg_replace("/style=\"width\:(.*)\"/", "", $newalt); | |||||
| //去掉结尾 | |||||
| $newalt = str_ireplace(" ", " ", $newalt); | |||||
| $newalt = str_ireplace(" /", "", $newalt); | |||||
| //检查$row是否为有效的数组并且包含title | |||||
| if (is_array($row) && isset($row['title'])) { | |||||
| //图片注释自动为标题 | |||||
| $newalt = str_ireplace(array('alt=""', "alt=''", 'title=""', "title=''"), "", $newalt); | |||||
| $newalt = str_ireplace("<img", "<img alt=\"".$row['title']."\" title=\"".$row['title']."\"", $newalt); | |||||
| //去掉图片宽度和高度 | |||||
| $newalt = preg_replace("/style=\"width\:(.*)\"/", "", $newalt); | |||||
| //去掉结尾多余的空格和斜杠 | |||||
| $newalt = str_ireplace(" ", " ", $newalt); | |||||
| $newalt = str_ireplace(" /", "", $newalt); | |||||
| } | |||||
| return $newalt; | return $newalt; | ||||
| } | } | ||||
| //联动单筛选{dede:php}obtainfilter(模型id,类型,'字段1,字段2');{/dede:php}类型表示前台展现方式,对应case值,例如:文档模型style字段radio选项卡类型,列表附加字段类别添加style,标签调用{dede:php}obtainfilter(1,1,'style');{/dede:php} | //联动单筛选{dede:php}obtainfilter(模型id,类型,'字段1,字段2');{/dede:php}类型表示前台展现方式,对应case值,例如:文档模型style字段radio选项卡类型,列表附加字段类别添加style,标签调用{dede:php}obtainfilter(1,1,'style');{/dede:php} | ||||