cakephp 2.0 - SEO pages not generating dynamic in sitemap.xml -
i generating sitemap.xml, generated 17 files has links on site means pages either in header or footer or interlinking have 50 seo pages not generating. don't have links on site means (header, footer , interlinking) in view/pages folder , method in pagescontroller. want dynamic generate 50 seo pages in sitemap.xml. how work please body asap. doing throgh generator.zip folder.
try
public function seo_sitemap() { $this->autorender=false; $data = $this->page->find('all'); if(!empty($data)) { $writer = new xmlwriter(); $writer->openuri(www_root.'/seo_pages_sitemap.xml'); $writer->startdocument('1.0', 'utf-8'); $writer->setindent(4); $writer->startelement('urlset'); $writer->writeattribute('xmlns:xsi', 'http://www.w3.org/2001/xmlschema-instance'); $writer->writeattribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9'); $writer->writeattribute('xsi:schemalocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'); foreach ($data $list) { $urls = siteurl."/".$list['page']['url'].".html"; $lin=utf8_encode($urls); $url_date = date(date_w3c, strtotime($list['page']['created'])); $writer->startelement('url'); $writer->writeelement('loc', $lin); $writer->writeelement('lastmod',trim($url_date)); $writer->writeelement('changefreq', 'always'); $writer->writeelement('priority', '0.8'); $writer->endelement(); } $writer->endelement(); $writer->enddocument(); echo siteurl.'sitemap.xml created<br>'; } }
Comments
Post a Comment