第一步:找到織夢(mèng)include目錄下的arc.archives.class.php ,應(yīng)該在286行吧!搜索function MakeHtml 函數(shù)即可
/** * 生成靜態(tài)HTML * * @access public * @param int $isremote 是否遠(yuǎn)程 * @return string */ function MakeHtml( $isremote = 0 ) {
找到這個(gè)函數(shù)的結(jié)尾,這一段:
$this->dsql->ExecuteNoneQuery("Update `dede_archives` SET ismake=1 WHERE id='".$this->ArcID."'"); return $this->GetTrueUrl($filename); }
改成
$this->dsql->ExecuteNoneQuery( "Update `dede_archives` SET ismake=1 WHERE id='" . $this->ArcID . "'" ); $returl = $this->GetTrueUrl( $filename ); $this->MakeWapHtml( $isremote ); return $returl; }
第二步,復(fù)制mip或者手機(jī)端模板文件到電腦端模板目錄下,舉例
電腦端模板為
templets
default
那么把手機(jī)端或者mip端模板放入后就是
templets
default
mip
這里需要注意下的是我mip端新增了函數(shù){dede:field.body function='replaceurl(@me)'/} 但是這個(gè)函數(shù)的執(zhí)行方法是在mip端的文件里面,所以需要把mip端的函數(shù)復(fù)制一份到同樣的pc端文件中(手機(jī)沒(méi)有新增函數(shù)就忽略);
切記只要手機(jī)活動(dòng)mip端獨(dú)有的函數(shù),都要在pc端使用一份,不然無(wú)法生成成功。
切記,如果手機(jī)或者mip模板采用了{(lán)dede:include filename="head.htm"/}標(biāo)簽
那么請(qǐng)改為{dede:include filename="mip/head.htm"/} mip改為自己的目錄
第三步,在第一步修改函數(shù)的后面增加函數(shù)
注意看里面的注釋,有2處
function MakeWapHtml( $isremote = 0 ) { $tempfile = $this->GetTempletFile(); $tempfile = str_replace( 'default', 'mip', $tempfile );//這里是把你電腦端的生成模板風(fēng)格改成手機(jī)端或者mip端的風(fēng)格,就是第二部要你放入的文件,你照著第二步的填即可,如果填錯(cuò),或獲取默認(rèn)的 if ( !file_exists( $tempfile ) || !is_file( $tempfile ) ) { } else { global $cfg_remote_site, $fileFirst; if ( $this->IsError ) { return ''; } $this->Fields[ "displaytype" ] = "st"; //預(yù)編譯$th $this->dtp->LoadTemplate( $tempfile ); $this->TempSource = $this->dtp->SourceString; $this->ParAddTable(); $this->ParseTempletsFirst(); $this->Fields[ 'senddate' ] = empty( $this->Fields[ 'senddate' ] ) ? '' : $this->Fields[ 'senddate' ]; $this->Fields[ 'title' ] = empty( $this->Fields[ 'title' ] ) ? '' : $this->Fields[ 'title' ]; $this->Fields[ 'arcrank' ] = empty( $this->Fields[ 'arcrank' ] ) ? 0 : $this->Fields[ 'arcrank' ]; $this->Fields[ 'ismake' ] = empty( $this->Fields[ 'ismake' ] ) ? 0 : $this->Fields[ 'ismake' ]; $this->Fields[ 'money' ] = empty( $this->Fields[ 'money' ] ) ? 0 : $this->Fields[ 'money' ]; $this->Fields[ 'filename' ] = empty( $this->Fields[ 'filename' ] ) ? '' : $this->Fields[ 'filename' ]; //分析要?jiǎng)?chuàng)建的文件名稱www.lol9.cn $filename = GetFileNewName( $this->ArcID, $this->Fields[ 'typeid' ], $this->Fields[ 'senddate' ], $this->Fields[ 'title' ], $this->Fields[ 'ismake' ], $this->Fields[ 'arcrank' ], $this->TypeLink->TypeInfos[ 'namerule' ], $this->TypeLink->TypeInfos[ 'typedir' ], $this->Fields[ 'money' ], $this->Fields[ 'filename' ] ); $filename = '/mip' . $filename;//改成你的mip端或者手機(jī)端目錄 //下面這里是系統(tǒng)參數(shù)生成的文檔HTML默認(rèn)保存路徑,如果你的是什么就改成什么,然后看你mip端在哪個(gè)路徑,默認(rèn)填錯(cuò)是系統(tǒng)電腦端的目錄沒(méi)事 $filename = str_replace( '/mip/html/', '/mip/html/', $filename ); $filenames = explode( ".", $filename ); $this->ShortName = $filenames[ count( $filenames ) - 1 ]; if ( $this->ShortName == '' )$this->ShortName = 'html'; $fileFirst = preg_replace( "/\." . $this->ShortName . "$/i", "", $filename ); $this->Fields[ 'namehand' ] = basename( $fileFirst ); $filenames = explode( "/", $filename ); $this->NameFirst = preg_replace( "/\." . $this->ShortName . "$/i", "", $filenames[ count( $filenames ) - 1 ] ); if ( $this->NameFirst == '' ) { $this->NameFirst = $this->arcID; } //獲得當(dāng)前文檔的全名 $filenameFull = GetFileUrl( $this->ArcID, $this->Fields[ 'typeid' ], $this->Fields[ "senddate" ], $this->Fields[ "title" ], $this->Fields[ "ismake" ], $this->Fields[ "arcrank" ], $this->TypeLink->TypeInfos[ 'namerule' ], $this->TypeLink->TypeInfos[ 'typedir' ], $this->Fields[ "money" ], $this->Fields[ 'filename' ], $this->TypeLink->TypeInfos[ 'moresite' ], $this->TypeLink->TypeInfos[ 'siteurl' ], $this->TypeLink->TypeInfos[ 'sitepath' ] ); $this->Fields[ 'arcurl' ] = $this->Fields[ 'fullname' ] = $filenameFull; //對(duì)于已設(shè)置不生成HTML的文章直接返回網(wǎng)址 if ( $this->Fields[ 'ismake' ] == -1 || $this->Fields[ 'arcrank' ] != 0 || $this->Fields[ 'money' ] > 0 || ( $this->Fields[ 'typeid' ] == 0 && $this->Fields[ 'channel' ] != -1 ) ) { return $this->GetTrueUrl( $filename ); } //循環(huán)生成HTML文件 else { for ( $i = 1; $i <= $this->TotalPage; $i++ ) { if ( $this->TotalPage > 1 ) { $this->Fields[ 'tmptitle' ] = ( empty( $this->Fields[ 'tmptitle' ] ) ? $this->Fields[ 'title' ] : $this->Fields[ 'tmptitle' ] ); if ( $i > 1 )$this->Fields[ 'title' ] = $this->Fields[ 'tmptitle' ] . "($i)"; } if ( $i > 1 ) { $TRUEfilename = $this->GetTruePath() . $fileFirst . "_" . $i . "." . $this->ShortName; } else { $TRUEfilename = $this->GetTruePath() . $filename; } $this->ParseDMFields( $i, 1 ); if ( !is_dir( dirname( $TRUEfilename ) ) ) { mkdir( dirname( $TRUEfilename ), 0777, true ); } $this->dtp->SaveTo( $TRUEfilename ); //如果啟用遠(yuǎn)程發(fā)布則需要進(jìn)行判斷 if ( $cfg_remote_site == 'Y' && $isremote == 1 ) { //分析遠(yuǎn)程文件路徑 $remotefile = str_replace( DEDEROOT, '', $TRUEfilename ); $localfile = '..' . $remotefile; //創(chuàng)建遠(yuǎn)程文件夾 $remotedir = preg_replace( "#[^\/]*\.html#", '', $remotefile ); $this->ftp->rmkdir( $remotedir ); $this->ftp->upload( $localfile, $remotefile, 'ascii' ); } } } $this->TempSource == ''; } }
好了 如果要同時(shí)手機(jī)端和mip端 那么重復(fù)上面一次,改下名字即可
版權(quán)聲明: 本站資源均來(lái)自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!
轉(zhuǎn)載請(qǐng)注明: 織夢(mèng)后臺(tái)發(fā)布文章后自動(dòng)生成手機(jī)靜態(tài)頁(yè)或MIP靜態(tài)頁(yè)