【phpcms-v9】phpcms-v9中給首頁flash幻燈片生成xml檔案
阿新 • • 發佈:2019-02-16
網站首頁一個flash的幻燈片載入xml檔案需要將檔案的生成程式碼寫到xml檔案內,使用如下程式碼:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?php
$sxml= "" ;?>
{pc:content
action= "position" siteid= "$siteid" posid= "1" isthumb= "1" order= "listorder
desc" num= "4" }
{loop
$data $r}
<?php
$sxml.= "<menu
url='" .$r['url ']."' frame= '_parent' imageUrl= '".$r[' thumb ']."' />";
?>
{/loop}
{/pc}
<?php
$sxml= "<?xml
version='1.0' encoding='utf-8'?><root imageWidth='680' imageHeight='345'>" .$sxml. "</root>" ;
$file= "(" phpcms_org_cn/xml/images.xml";
$fp
= fopen($file, "w" );
if ($fp){
fwrite($fp,$sxml); fclose($fp);
}
?>
|
檢視images.xml是全站首頁的所有程式碼,進行精簡,把:
$file="("phpcms_org_cn/xml/images.xml";
$fp = fopen($file,"w");
合成一句 :
$fp = fopen("phpcms_org_cn/xml/images.xml","w");