Giter Club home page Giter Club logo

codeigniter-sitemaps's Introduction

Sitemaps for CodeIgniter

codeigniter-sitemaps allows you to generate XML sitemaps for your codeigniter based applications quickly and easily.

Basic autodetection of pages is included using auto_detect() which assumes method == page and adds urls to the sitemap accordingly, this can be restricted using the exclude parameter.

Please feel free to contribute or file bugs.

The directory you're writing the sitemap to must be writable.

System Requirements

  • Codeigniter 2.0+
  • PHP5.3 is required for ISO 8601 date compatibility.

Installation

Put the contents of this archive in your system/application folder.

Or use sparks:

php tools/spark install codeigniter-sitemaps

Example Usage

//if you're using sparks
$this->load->spark('codeigniter-sitemaps/0.0.1')

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

//assuming a hypothetical posts_model
$posts = $this->posts_model->get_posts();

    foreach ($posts AS $post)
    {
        $item = array(
            "loc" => site_url("blog/" . $post->slug),
            "lastmod" => date("c", strtotime($post->last_modified)),
            "changefreq" => "hourly",
            "priority" => "0.8"
        );

        $this->sitemaps->add_item($item);
    }

// file name may change due to compression
$file_name = $this->sitemaps->build("sitemap_blog.xml");

$reponses = $this->sitemaps->ping(site_url($file_name));

There is also autodetect functionality see code & comments for more details

Thanks

This library is based on work by Philipp Dörner 2010 http://signalkraft.com/google-sitemaps-for-codeigniter

codeigniter-sitemaps's People

Contributors

nfourtythree avatar safad avatar slivero avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.