[eluser]Deathmanlp[/eluser]
When I try to use the URI class from a library I get a undefined property error
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Articles_list_lib
{
function __construct ()
{
$CI=null;
$this->CI =& get_instance();
}
function show_errors ($errors)
{
foreach ($errors as $error)
{
echo $error."<br/>";
}
}
function list_links ($links)
{
foreach ($links as $link)
{
echo $link."<br/>";
}
}
function list_pages ($n_pages)
{
$start=0;
$pages= array();
for ($i=1;$i<=$n_pages;$i++)
{
$pages["page".$i]=anchor ("blog/index/".$start, $i);
$start+=20;
}
$current_page=$this->uri->segment(3); // line 35
}
}
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: Articles_list_lib::$uri
Filename: libraries/Articles_list_lib.php
Line Number: 35