Welcome Guest, Not a member yet? Register   Sign In
Usnig th URI class in library
#1

[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


Messages In This Thread
Usnig th URI class in library - by El Forum - 09-07-2010, 02:31 AM
Usnig th URI class in library - by El Forum - 09-07-2010, 02:33 AM
Usnig th URI class in library - by El Forum - 09-07-2010, 02:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB