php - CodeIgniter - Can not load custom library in MX_Controller -


this library created:

<?php if ( !defined('basepath')) exit('no direct script access allowed');  class my_cart extends ci_cart {      public $ci;      function __construct() {          parent::__construct();          // override product_name_rules insert         $this->product_name_rules = '\.\:\-_ a-z0-9_ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚĂĐĨŨƠàáâãèéêìíòóôõùúăđĩũơƯĂẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼỀỀỂưăạảấầẩẫậắằẳẵặẹẻẽềềểỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪễệỉịọỏốồổỗộớờởỡợụủứừỬỮỰỲỴÝỶỸửữựỳỵỷỹ';      }  }  /* end of file my_cart.php */ /* location: ./application/libraries/my_cart.php */ 

and controller:

http://img845.imageshack.us/img845/5994/vegf.png


if autoload library, error "cannot access empty property". morever, $data can't full value html code. don't know why, can't see wrong.

<form action="<?php echo base_url('add_to_cart');?>">     <input type="hidden" name="productid" value="<?php echo $product->id; ?>"/>     <input type="hidden" name="productname" value="<?php echo $product->tensp; ?>" />     <input type="hidden" name="productprice" value="<?php echo $product->gia; ?>" />     <input type="hidden" name="productimg" value="<?php echo $product->hinhanh; ?>" />     <input type="submit" class="bay" value="" title="mua sản phẩm"/> </form> 

have idea problem? much!

the my_ prefix handled magically behind scenes. load library,

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

you can read on @ bottom of 'creating libraries' page in docs.


Comments