Ejemplo n.º 1
0
 public function flashxml()
 {
     $Cxml = new Cxml();
     $Cxml->root = 'rss';
     $Cxml->root_attributes = array('version' => '2.0');
     $Cxml->NodeName = 'item';
     $xmldata = $Cxml->Cxml($array, './rss.xml');
     //生成xml
 }
Ejemplo n.º 2
0
 public function docreatesitemap()
 {
     if ($_GET['htmlmap']) {
         $r = $this->create_index(1);
     }
     if ($_GET['xmlmap']) {
         import("@.ORG.Cxml");
         $array = array();
         $array[0]['NodeName']['value'] = 'url';
         $array[0]['loc']['value'] = $this->Config['site_url'];
         $array[0]['lastmod']['value'] = date('Y-m-d', time());
         $array[0]['changefreq']['value'] = 'weekly';
         $array[0]['priority']['value'] = 1;
         foreach ((array) $this->module as $r) {
             if ($r['issearch']) {
                 $num = intval($_GET[$r['name']]);
                 if (!$num) {
                     continue;
                 }
                 $data = M($r['name'])->field('id,title,url,createtime')->where("status=1")->order('id desc')->limit('0,' . $num)->select();
                 foreach ($data as $key => $res) {
                     $arraya[$key]['NodeName']['value'] = 'url';
                     $arraya[$key]['loc']['value'] = $this->Config['site_url'] . $res['url'];
                     $arraya[$key]['lastmod']['value'] = date('Y-m-d', $res['createtime']);
                     $arraya[$key]['changefreq']['value'] = 'weekly';
                     $arraya[$key]['priority']['value'] = 0.7;
                 }
                 $array = array_merge($array, $arraya);
             }
         }
         $Cxml = new Cxml();
         $Cxml->root = 'urlset';
         $Cxml->root_attributes = array('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9');
         $xmldata = $Cxml->Cxml($array, './sitemap.xml');
         $d = file_exists('./sitemap.xml');
     }
     if ($_GET['htmlmap'] && $r || $_GET['xmlmap'] && $d) {
         $this->success(L('DO_OK'));
     } else {
         $this->error(L('Create error.'));
     }
 }