0
<div class="carousel-inner">
    <?php $category = $this->category_model->getCategories(999,0,51);?>
    <?php $categorynext = $this->category_model->getCategories(999,0,51);?>
     <div class="item active">
          <div class="row-fluid">
          <?php $count=0;?>
          <?php foreach($category as $category):?>
          <?php $count=$count+1;?>
          <div class="span2"><a href="#x" class="thumbnail"><img src="<?= base_url();?>assets/upload/category/<?= $category->image?>" alt="Image" style="max-width:100%;"></a></div>
          <?php if($count==6) break;?>
          <?php endforeach;?>
        </div><!--/row-fluid-->
    </div><!--/item-->

    <div class="item ">
          <div class="row-fluid">
          <div class="span2"><a href="#x" class="thumbnail"><img src="<?= base_url();?>assets/upload/logo/computer.png" alt="Image" style="max-width:100%;"></a></div>
          <div class="span2"><a href="#x" class="thumbnail"><img src="<?= base_url();?>assets/upload/logo/helthcare.png" alt="Image" style="max-width:100%;"></a></div>
          <div class="span2"><a href="#x" class="thumbnail"><img src="<?= base_url();?>assets/upload/logo/image.png" alt="Image" style="max-width:100%;"></a></div>
          <div class="span2"><a href="#x" class="thumbnail"><img src="<?= base_url();?>assets/upload/logo/ipod.png" alt="Image" style="max-width:100%;"></a></div>
          <div class="span2"><a href="#x" class="thumbnail"><img src="<?= base_url();?>assets/upload/logo/helthcare.png" alt="Image" style="max-width:100%; "></a></div>
          <div class="span2"><a href="#x" class="thumbnail"><img src="<?= base_url();?>assets/upload/logo/image.png" alt="Image" style="max-width:100%;"></a></div>

        </div>
    </div>
   </div> 

this is the code.1st i have fetched 6 image at a time from database in <div class="item active"> .But Next 6 image will be fetched at a time from database in <div class="item "> and again and again in <div class="item ">.i can't this.

Edited by sanctifiedsantosh: for code

2
Contributors
3
Replies
20
Views
3 Years
Discussion Span
Last Post by albucurus
0

What do getCategories() method ?
What do you do with $category array must do with $categorynext in <div class="item ">. But, you display first 6 inactive item, how you display the next 6... you need some pagination here.

Show us the code of category_model class first.

0

Actually i have to show all images from database in a image slider.There are two div in this slider 1st is <div class="item active"> and 2nd is <div class="item ">.When page is loaded then 1st 6 image sliding in <div class="item active"> and rest images(6 images at a time.<div class="item "> will ve loaded after 6 image sliding) will be slide in <div class="item ">.So ihave complete the work of 1st div using calculation of counter.but i can't the work of next div

0

Can use a for cicle, but this is the complex way:

$num_row = count($categorynext);
$x = 7;
for($i = $x; $i< $num_row; $i++)
{  
    //display next 6 pictures
    if($i % $x == 0)
    { 
        break;
        $x = $i + 1;
    }
}   

But this code must be triggerd by a button or other event for you can display next 6 pictures.

An other way is to use a SELECT with LIMIT clause.

SELECT * from table WHERE conditions LIMIT offset, 6

Search on internet how to make pagination with PHP. You will need some Javascript and Ajax too so as to dont make refresh of page from 6 in 6 records.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.