How to add SEO plugin in Codeigniter -
i using codeigniter. want add seo plugin.i found code,but don't know how apply it.my code is,
controllers/seo.php class seo extends ci_controller { function sitemap() { $data = "";//select urls db array header("content-type: text/xml;charset=iso-8859-1"); $this->load->view("sitemap",$data); } } views/sitemap.php <?= '<?xml version="1.0" encoding="utf-8" ?>' ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc><?= base_url();?></loc> <priority>1.0</priority> </url> <!-- code looking quite different, principle similar --> <?php foreach($data $url) { ?> <url> <loc><?= base_url().$url ?></loc> <priority>0.5</priority> </url> <?php } ?> </urlset> config/routes.php $route['seo/sitemap\.xml'] = "seo/sitemap";
how works on search engine?any 1 please me.
the code pasted contains code 3 files shows. i) controller class of codeigniter application/controllers/seo.php ii) view loaded sitemap function of seo controller. application/views/sitemap.php outputs xml sitemap file. iii) , route added application/config/routes.php
note: main , function in code incomplete useless is. need add few lines retrieve data database & assign $data variable.
once completed can used path sitemap of website managed via database.
i hope able make clear.
Comments
Post a Comment