Welcome Guest, Not a member yet? Register   Sign In
Photo Gallery
#3

[eluser]alectrash[/eluser]
I did this a while ago, not sure if it helps?
In controller I have

Code:
function page()
{
    $data['menuitem'] = $this->uri->segment(1);
    $data['itemnumber'] = $this->uri->segment(3);
    
    //get query for all digital art
    $data['query'] = $this->db->where('dbstatus', 'published')->get('tblmedia');
    $item_count = count($data['query']->result());
    $config['base_url'] = '/gallery/page';
    $config['total_rows'] = $item_count;
    $config['per_page'] = '12';
    $data['per_page'] = $config['per_page'];
    
    
    $this->pagination->initialize($config);
    if($item_count > $config['per_page'])
    {
     $this->pagination->create_links();  
    }
    
    $this->load->view('gallery_view', $data);
    
}

And in view I have

Code:
<div id="gallery">
<h2>Gallery</h2>
&lt;?=$this->pagination->create_links();?&gt;
&lt;?php

  $counteditems = 0;
  
  if(isset($itemnumber))
  {
    $itemnumber = $itemnumber;
  }
  else
  {
    $itemnumber = 0;
  }
  
  $endnumber = $itemnumber + 12;
  
  echo "<div class='itemrow'>";
  foreach($query->result() as $row)
    {
    if($counteditems >= $itemnumber && $counteditems < $endnumber)
    {
        echo '<div class="item">';
        echo '<p>
        <a >dburl . '" title="' . $row->dburl . '"><img >dbthumbimage . '" alt="' . $row->dburl . '" /></a>
        <a >dburl . '" title="' . $row->dburl . '">' . $row->dbtitle . '</a></p>';
        echo '</div>';
        
        $rownumber = ($counteditems+1) / 4;
        
        if(is_int($rownumber) && $rownumber !== 0)
        {
          echo "</div><div class='itemrow'>";
        }
    }
     $counteditems++;
  }
  echo "</div>"

?&gt;
</div>

It makes an nice 4 by 3 grid of thumbnails that link to another page where u can view image and a comment etc


Messages In This Thread
Photo Gallery - by El Forum - 10-09-2008, 07:48 PM
Photo Gallery - by El Forum - 10-28-2008, 09:43 AM
Photo Gallery - by El Forum - 10-28-2008, 10:26 AM
Photo Gallery - by El Forum - 10-28-2008, 10:33 AM
Photo Gallery - by El Forum - 10-28-2008, 11:04 AM
Photo Gallery - by El Forum - 10-28-2008, 11:24 AM
Photo Gallery - by El Forum - 10-28-2008, 05:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB