精品国产免费观看久久久_久久天天躁狠狠躁夜夜爽_无码人妻少妇久久中文字幕_狠狠做深爱婷婷久久综合一区

學(xué)習(xí)筆記

精準傳達 ? 價值共享

洞悉互聯(lián)網(wǎng)前沿資訊,探尋網(wǎng)站營銷規(guī)律

織夢讓手機站的圖片變成自適應(yīng) 并且絕對路徑

作者:狐靈科技 | 2020-02-22 15:54 |點擊:

大部分手機站都是自適應(yīng)的,這樣圖片就不能有寬高限制,我們添加文章圖片時很多時候都會有width height style這些屬性在里面,在手機站上要把它們清除并且讓圖片和附件都使用上絕對路徑,又不能影響電腦站的,不修改程序內(nèi)核文件,我們可以在手機版內(nèi)容頁模板里,

把手機站內(nèi)容頁模板把調(diào)用文章內(nèi)容的標簽,找到

{dede:field.body/}

改成

{dede:field.body runphp=yes}
global $cfg_basehost;
$str = @me;
$search = '/(<img.*?)width=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';
$search1 = '/(<img.*?)height=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';
$search2 = '#(<img.*?style=".*?)width:\s{0,}\d+px;([^"]*?.*?>)#i';
$search3 = '#(<img.*?style=".*?)height:\s{0,}\d+px;([^"]*?.*?>)#i';
$content = preg_replace($search,'$1$3',$str);
$content = preg_replace($search1,'$1$3',$content);
$content = preg_replace($search2,'$1$2',$content);
$content = preg_replace($search3,'$1$2',$content);
@me = str_replace('/uploads/', $cfg_basehost.'/uploads/', $content);
{/dede:field.body}

如果是欄目內(nèi)容的圖片要自適應(yīng)的話那標簽

{dede:field.content/}

改成

{dede:field.content runphp=yes}
global $cfg_basehost;
$str = @me;
$search = '/(<img.*?)width=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';
$search1 = '/(<img.*?)height=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';
$search2 = '#(<img.*?style=".*?)width:\s{0,}\d+px;([^"]*?.*?>)#i';
$search3 = '#(<img.*?style=".*?)height:\s{0,}\d+px;([^"]*?.*?>)#i';
$content = preg_replace($search,'$1$3',$str);
$content = preg_replace($search1,'$1$3',$content);
$content = preg_replace($search2,'$1$2',$content);
$content = preg_replace($search3,'$1$2',$content);
@me = str_replace('/uploads/', $cfg_basehost.'/uploads/', $content);
{/dede:field.content}

 

 

 


如沒特殊注明,文章均為狐靈科技原創(chuàng),轉(zhuǎn)載請注明?? "織夢讓手機站的圖片變成自適應(yīng) 并且絕對路徑
多一份免費策劃方案,總有益處。

請直接添加技術(shù)總監(jiān)微信聯(lián)系咨詢

網(wǎng)站設(shè)計 品牌營銷

多一份參考,總有益處

聯(lián)系狐靈科技,免費獲得專屬《策劃方案》及報價

咨詢相關(guān)問題或預(yù)約面談,可以通過以下方式與我們聯(lián)系

業(yè)務(wù)熱線:15082661954 / 大客戶專線:15523356218