1

I'm trying to get evert's sitemap-php library working in CodeIgniter using the vague instructions that I found in another StackOverflow post, but I'm not having any success. I've got a few questions that should be enough to point me in the right direction when answered:

  1. Should the makeSitemap() function be added to the default controller?

  2. If evert's Sitemap.php file is placed in the libraries folder (instead of nested in the SitemapPHP folder like the example), can it be loaded properly using the standard CI syntax?

    $this->load->library('sitemap');

  3. Where does the sitemap folder belong?

I'd greatly appreciate any insight on these questions. Unless someone beats me to it, I'll be sure to post a code-based solution once I get this working.

Community
  • 1
  • 1
Tyler F.
  • 124
  • 1
  • 12

1 Answers1

0

You can do it on two ways. First would be modifying Sitemap.php code including property (i.e. $CI) and getting codeigniter's object by reference in constructor as described in documentation. However second way would be using composer autoloader and IMHO that should be your prefered way. In this answer I described how to use github repository in CI application but there is more answers and articles that can point you in right direction how to use composer in CI. If you go with first way, you would call $this->sitemap->method() and if you would go with second method, you would use library as described on github's readme section.

Community
  • 1
  • 1
Tpojka
  • 6,996
  • 2
  • 29
  • 39