CODEIGNITER 2.2.0 setup on ipage

I had a problem with setting up CI on my domain hosted by iPage. First clean install only shows a blank page. So I change the config.php with the ff:

$config[‘base_url’]    = ‘http://my domain.com/’;
>$config[‘uri_protocol’]    = ‘QUERY_STRING’;

This actually displays my welcome page. I was quite excited at this moment since i seem to be heading to the right path. Then i decided to eliminate index.php from my URI’s so i set-up my .htaccess file as follows: Continue reading “CODEIGNITER 2.2.0 setup on ipage”

Codeigniter Pagination Sample

  • Create a Model : M_products ( auto-loaded)

class M_Products extends Model{
 function M_Products(){
 parent::Model();
 }
/* this function will retrieve records
 *   from the table products
 *  params
 *  param $limit -> this will determine the number of records to be displayed
 *  param $offset -> this will step through the beginning of the next set of
 *                                  of records to be displayed
 *  returns the result
 */
function get_products($limit,$offset) {
         $this->db->limit($limit,$offset);
         $query = $this->db->get('products');
          return $query->result();
 }
// this will return the total number of records
 function count_products() {
      return $this->db->count_all('products');
 }
 }
  • Create the Controller : Product_list

class Product_list extends Controller {
 function Welcome() {
 parent::Controller();
 }
function list_product($offset='') {
 $limit = 2;   //====èthe number of products displayed
 $data['result'] = $this-> M_Products ->get_products($limit,$offset); //è get the records
 // use codeigniter pagination
 $this->load->library('pagination');
 $this->load->helper('url');
 $config['base_url'] = site_url() . '/Product_list/list_product'; //==> important
 $config['total_rows'] = $this-> M_Products ->count_products(); //-> count number of records
 $config['per_page'] = $limit;
 $this->pagination->initialize($config);
 $data['page_link'] = $this->pagination->create_links();
 $this->load->view(‘product_list_view’,$data)
 }
}
  • Create the View: product_list_view

<h1>Welcome to Test Pagination</h1>
 <?php
//var_dump($result);
 foreach($result as $l) {
 echo $l->name."<br/>";
 }
 echo $page_link;
 ?>

Just a Reminder of the CHmOd 777 thingy.

chmod 777 -R /home/e-smith/files -> /images/products (” Just let me write to this location .. OK”)

– after several hours of writing codes for file uploads i got to this “thingy”. CI burps and spit out my uploaded files and blasted on me saying “The directory you are trying to upload to — I don’t think its WRITABLE”. Whew … I look at the time and i think it has been almost 7 hours now i had been trimming and combing my development/portfolio page and CI just halted me with that message. I think it’s time for me to stop and prepare for another day. Or maybe just rest for a couple of hours and start banging heads again. OK CHMOD 777 and i rest.

open_basedir restriction in effect (error in file uploads) – codeigniter problem on SME server

I was getting an error message during uploading files to my server, and the message is as shown below :
message getimagesize() function.getimagesize open_basedir restriction in effect
And i just found the solution :

PHP Related Commands
Show current php settings
– config show php

Continue reading “open_basedir restriction in effect (error in file uploads) – codeigniter problem on SME server”

Up ↑

%d bloggers like this: