Welcome Guest, Not a member yet? Register   Sign In
Create Simple Codeigniter library
#1

[eluser]Dileep[/eluser]
For my current project i decided to create a library for some common functionalities.

Ex : Login_check,get_current_user etc.

With my little knowledge i created a simple one but unfortunately its not working.

Here my library :

FileName : Pro.php and located in application/libraries
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Pro{

    public function __construct()
    {

    parent::_construct();
        $CI =& get_instance();
       $CI->load->helper('url');
       $CI->load->library('session');
    $CI->load->database();
    }

function show_hello_world()
{
     $text = "Hello World";
  return $text;
}
}

?>

And i tried to load it on my controller :

Code:
<?php
class Admin extends CI_Controller
{
    function __construct()
    {    
        parent::__construct();
        $this->load->database();
        $this->load->library(array('session'));
        $this->load->library("Pro");
    }
    function index()
    {
        echo($this->Pro->show_hello_world());
    }
}

?>
I cant see any erros there...but i am getting a blank page.

Whats wrong with me ??

Thank you .




Theme © iAndrew 2016 - Forum software by © MyBB