Welcome Guest, Not a member yet? Register   Sign In
Paginate on Array
#1

[eluser]jay2003[/eluser]
Hi,

I am new to code igniter and am building a photo gallery for a client. So far it uploads multiple files using uloadify, creates a unique directory to upload the files to, creates a thumbnail and watermarks.

I how have a gallery page which loads a gallery and does so by doing the following;

Code:
public function get_images($dir_name)
{
  $files = scandir('./uploads/' . $dir_name);
  $files = array_diff($files, array('.', '..', 'thumbs'));
  
  $images = array();
  
  foreach ($files as $file)
  {
  $images[] = array (
  'url' => '/uploads/' . $dir_name . '/' . $file,
  'thumb_url' => '/uploads/' . $dir_name . '/thumbs/' . $file,
  'file_name' =>  $file
  );
  }
  
  return $images;  
  
}

This is all working fine and the gallery looks great but am now stuck at pagination. Ive seen the pagination built into code igniter used when interacting with databases but as I am just loading an array based on contents of a directory how would i go about adding pagination?

Any help would be much appreciated.

Thanks

Jason


Messages In This Thread
Paginate on Array - by El Forum - 03-15-2012, 07:52 AM
Paginate on Array - by El Forum - 03-15-2012, 08:18 AM
Paginate on Array - by El Forum - 03-15-2012, 08:48 AM
Paginate on Array - by El Forum - 05-28-2012, 06:23 PM
Paginate on Array - by El Forum - 05-28-2012, 06:26 PM
Paginate on Array - by El Forum - 05-28-2012, 06:38 PM
Paginate on Array - by El Forum - 05-28-2012, 06:44 PM
Paginate on Array - by El Forum - 05-28-2012, 07:03 PM
Paginate on Array - by El Forum - 05-28-2012, 07:15 PM
Paginate on Array - by El Forum - 05-28-2012, 07:24 PM
Paginate on Array - by El Forum - 05-28-2012, 07:36 PM
Paginate on Array - by El Forum - 05-28-2012, 08:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB