问题
I have created website using the CI framework 3.0 and still i am stuck in creating the xml sitemap for static and dynamic pages.
回答1:
Your question is very clear. i'm using codeigniter with the sitemap php Library. Its awesome and has clear directions: https://github.com/evert/sitemap-php
To get you started - Put the SitemapPHP folder in application/libraries
Then, in your controller, in your method you call the library like:
public function makeSitemap()
{
// APPPATH will automatically figure out the correct path
include APPPATH.'libraries/SitemapPHP/Sitemap.php';
// your website url
$sitemap = new Sitemap('http://yourwebsite.com');
// This will also need to be set by you.
// the full server path to the sitemap folder
$sitemap->setPath('/home/username/public_html/sitemap/');
// the name of the file that is being written to
$sitemap->setFilename('mysitemap');
// etc etc etc
}
来源:https://stackoverflow.com/questions/40624981/how-to-create-sitemap-for-static-and-dynamic-pages