欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

dedecms

當前位置:主頁 > CMS教程 > dedecms >

織夢CMS改造mip教程

來源:本站原創(chuàng)|時間:2021-08-05|欄目:dedecms|點擊: 次

頁面整體結(jié)構(gòu)改造
 
<!DOCTYPE html>
<html mip>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://c.mipcdn.com/static/v1/mip.css">
<script src="/dist/js/jquery.js" type="application/json" async></script>
<style mip-custom>
樣式
</style>
    </head>
    <body>
<mip-img layout="responsive" src="[!--news.url--]dist/img/logo.png" ></mip-img>
<script src="https://c.mipcdn.com/static/v1/mip.js"></script>
    </body>
</html>
 
mip規(guī)范結(jié)構(gòu)大致如上代碼,具體的就自行修改。
 
mip圖片改造
圖片的格式需要換成<mip-img layout="responsive" src="/st/images/logo-b.png"></mip-img>
 
我增加了一個函數(shù),在include 里面的extend.func.php 下。這個應該所有的php后臺都是試用的
 
function replaceurl($content){
//$pattern = "/<img(.*?)src=('|")([^>]*).(bmp|gif|jpeg|jpg|png)('|")(.*?)>/i";
$pattern="/<img.*?src=['|"](.*?(?:[.gif|.jpg|.jpeg]|.png]|.bmp]))['|"].*?[/]?>/";
preg_match_all($pattern, $content,$matches);
$full_img = $matches[0];
$full_src = $matches[1];
foreach ($full_img as $k => $v) {
$v1 = str_replace("<img", "<mip-img", $v);
$v1 = str_replace("/>", "></mip-img>", $v1);
$v1 = str_replace('src="/ueditor','src="/ueditor',$v1);
$new_path = $url.$full_src[$k];
$v1 = str_replace($full_src[$k], $new_path, $v1);
$content = str_replace($v, $v1, $content);
}
return $content;
}
 
后面又研究了下,如果是用的織夢的編輯器,就會產(chǎn)生style,于是我又弄了另外一個然后織夢調(diào)用主體內(nèi)容 {dede:field.body function='replaceurl(@me)'/} 執(zhí)行了下函數(shù)替換了img標簽。
 
function replaceurl($content){
$pattern = Array("/<img(.*?)src=('|")([^>]*).(bmp|gif|jpeg|jpg|png)('|")(.*?)>/i","/style=(.*?)>/i");
$replacement = Array("<mip-img  popup  src=$2$3.$4$2></mip-img>",">");
$content = preg_replace($pattern, $replacement, $content);
return $content;  
}
 
這個的話就直接把style去掉了,好歹解決了吧!推薦用下面這個。
 
style標簽去除
我們在里面會更改字的樣子,就會產(chǎn)生style,又得替換
 
function replaceurl($content){
$pattern = Array("/<img(.*?)src=('|")([^>]*).(bmp|gif|jpeg|jpg|png)('|")(.*?)>/i","/style=(.*?)>/i");
$replacement = Array("<mip-img  popup  src=$3.$4></mip-img>",">");
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
 
還是一樣主體內(nèi)容 {dede:field.body function='replaceurl(@me)'/}  這樣調(diào)用,具體如果還需要詳細的話可以更改里面的正則表達式
 
不去掉文章style
比較麻煩,網(wǎng)上看見的,沒測試是否可行,可以自行研究下,大概就是提取body里面的style生成class然后再調(diào)用到頭部去
 
因為我的并沒有用多少style所以懶搞的了。
 
(1)、找到include/arc.archives.class.php,找到函數(shù)ReplaceKeyword($kw,&$body),大概1182行,在這個函數(shù)后面添加如下2個函數(shù):
 
function replacePicUrl($content = null, $url="") {
$pattern = "/<img(.*?)src=('|")([^>]*).(bmp|gif|jpeg|jpg|png)('|")(.*?)>/i";
$replacement = "<mip-img src={$url}$3.$4></mip-img>";
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
function getStyle($content = null){
preg_match_all("/style=('|")([^'"]+)('|")/",
$content,$matches);
$styles = $matches[0];
$styles_value = $matches[2];
$style_custom = "";
$i = 0;
foreach($styles_value as $key){
$style_custom .= ".class".$i."{".$key."}";
$class_name = 'class="class'.$i.'"';
$replacements = $class_name;
$patterns = $styles[$i];
$content = str_replace($patterns, $replacements, $content);
$i++;
}
$res['style_custom'] = $style_custom;
$res['content'] = $content;
return $res;
}
 
$this->SplitTitles = Array();上面,(2)在函數(shù)ParAddTable()里的
 
unset($row);下面,大概253行添加如下代碼:
 
$content = $this->replacePicUrl($this->Fields['body'], $GLOBALS['cfg_basehost']);
$content_arr = $this->getStyle($content); 
$this->Fields['body'] = $content_arr['content'];
$this->Fields['style_custom'] = $content_arr['style_custom'];
 
(3)、找到函數(shù)MakeHtml($isremote=0),大概358行,在里面的
 
$this->Fields['filename'] = empty($this->Fields['filename'])? '' : $this->Fields['filename'];下面添加如下代碼:
 
$this->Fields['style_custom'] = empty($this->Fields['style_custom'])? '' : $this->Fields['style_custom'];
(4)、在templete的article_article.htm模板中的head標簽內(nèi)添加如下代碼:
<style mip-custom>
{dede:field.custom_style/}
</style>
 
文章內(nèi)鏈更換
注明:內(nèi)鏈請勿填寫絕對地址,還是在上面2、3的方法里面改,還是增加一個變量正則,然后替換。mengdiqiu.com.cn
 
function replaceurl($content){
$pattern = Array("/<img(.*?)src=('|")([^>]*).(bmp|gif|jpeg|jpg|png)('|")(.*?)>/i","/style=(.*?)>/i",'/<ab[^>]+bhref="([^"]*)"[^>]*>/i');
$replacement = Array("<mip-img  popup  src=/$3.$4></mip-img>",">",'<a  data-type="mip" href=http://mengdiqiu.com.cn$1>');
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
 
文章文檔關(guān)鍵詞鏈接更換
如果你用了織夢自帶的關(guān)鍵字加鏈接,在核心》批量維護》文檔關(guān)鍵詞維護里面,那么就要替換成絕對地址與增加mip鏈接格式
 
打開include/arc.archives.class.php 文件 ,大概在1219行,在變量$key_url前面加上自己的鏈接,與href前面加上 data-type=mip
 
$query = "SELECT * FROM dede_keywords WHERE rpurl<>'' ORDER BY rank DESC";
$this->dsql->SetQuery($query);
$this->dsql->Execute();
while($row = $this->dsql->GetArray())
{
$key = trim($row['keyword']);
$key_url=trim($row['rpurl']);
$karr[] = $key;
$kaarr[] = "<a  data-type=mip href='http://mengdiqiu.com.cn$key_url'><u>$key</u></a>";
}
 

上一篇:dedecms當前欄目靜態(tài)鏈接調(diào)用方法

欄    目:dedecms

下一篇:dedecms文章審核后給會員增加積分或者金幣的辦法

本文標題:織夢CMS改造mip教程

本文地址:http://mengdiqiu.com.cn/a1/dedecms/15142.html

更多dedecms

您可能感興趣的文章

閱讀排行

本欄相關(guān)

隨機閱讀

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導致的法律后果,本站均不負任何責任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有