Tutorialsplane

Codeigniter Trackback Class Library


Codeigniter Trackback Class Library – We can load trackback class library using $this->load->library(‘trackback’);. This library provide various functions that are used to enable you to send and recieve trackback data. Here in this tutorial, we are going to explain how to use trackback class library.


Codeigniter trackback class library | Example

Let us understand how trackback class library works in codeigniter with examples.

Load trackback class library

First load trackback class library to use its functions, this library can be loaded simply as below-

How to load trackback class library:

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

Functions:-

There are following functions available in trackback class library. Now we will explain.

1. Sending Trackbacks.

Here is simple demo of sending trackbacks.

Syntax of sending trackbacks function.

<?php defined('BASEPATH') OR exit('No direct script access allowed');
class trackbacks_controller extends CI_Controller 
{
public function track()
{
$this-?>load->library('trackback');
$tb_data = array(
'ping_url'  => 'http://example.com/trackback/456',
'url'       => 'http://www.my-example.com/blog/entry/123',
'title'     => 'The Title of My Entry',
'excerpt'   => 'The entry content.',
'blog_name' => 'My Blog Name',
'charset'   => 'utf-8'
);
if ( ! $this->trackback->send($tb_data))
{
echo $this->trackback->display_errors();
}
else
{
echo 'Trackback was sent!';
}
}
}
?>

Tracksback can be sent from any of your controller using code.

Description of example array data.

Models

Connect Database

Helpers

Libraries

Helper Reference

Library Reference

Database Reference