1

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.

James Z
  • 12,209
  • 10
  • 24
  • 44
  • 1
    Welcome to Stack Overflow! There is very little information in your question. I suggest you [edit] it to show us your code and/or configuration. Help us help you: try to give us the information that we need to diagnose the problem. – S.L. Barth is on codidact.com Nov 16 '16 at 07:42

1 Answers1

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 

}
cartalot
  • 3,147
  • 1
  • 16
  • 14
  • I received the following error "Unable to locate the specified class: Session.php" although I've autoloaded sessions and by var_dump() I've check data is printing just fine. I believe this is causing the issue. $sitemap = new Sitemap('localhost/tickets/'); – Musa Butt Jul 26 '19 at 19:19