title: How to slides the uploaded images using CodeIgniter
body: <p>In my application we can create shops. At that time we have to upload many images. Then we go to the detailed view of that particular shop, shows all images we uploaded in sliding manner that is display one another.</p>
  
  <p>But I don't know how to create a for loop in view page.</p>
  
  <p><strong>controller</strong></p>
  
  <pre><code>            for($i=0; $i&lt;$cpt; $i++)
              {
  
                  $_FILES['userfile']['name']= $files['userfile']['name'][$i];
                  $_FILES['userfile']['type']= $files['userfile']['type'][$i];
                  $_FILES['userfile']['tmp_name']= $files['userfile']['tmp_name'][$i];
                  $_FILES['userfile']['error']= $files['userfile']['error'][$i];
                  $_FILES['userfile']['size']= $files['userfile']['size'][$i];    
  
                  $this-&gt;upload-&gt;initialize($this-&gt;set_upload_options($shop_id,$i));
  
                  $this-&gt;upload-&gt;do_upload('userfile'); 
              }
  
              if (!$this-&gt;upload-&gt;do_upload('userfile'))
              {     
                  echo $this-&gt;upload-&gt;display_errors();  
              }
  
              if($session_user_id != ''){
                 $data['files'] = $files_uploaded;
                 $this-&gt;load-&gt;view('header', $data);
                 $this-&gt;load-&gt;view('shop_detail_view', $data);
                 $this-&gt;load-&gt;view('footer',$data);
                 // redirect(base_url().'user');
              }else{
                  redirect(base_url().'login/index/shop/'.$shop_id);
              }
  
  
          private function set_upload_options($shop_id,$i)
          {   
             $config = array(); 
             $config['file_name']    = $shop_id.'_'.$i.'.jpg';   
             $config['upload_path'] = './application/assets/images/shops/';
             $config['allowed_types'] = 'jpg';   
             return $config;
          } 
  </code></pre>
  
  <p>Suppose upload 3 images that names are 2_0.jpg,2_1.jpg,2_2.jpg like that
  2 is the shop_id  </p>
  
  <p>I retrieve the images from the folder and displayed in sliding manner</p>
  
  <p>I have a doubt in my view page. Now I put in this way</p>
  
  <p><strong>view</strong></p>
  
  <pre><code> &lt;div id="shopCarousel" class="carousel shopCarousel slide" data-ride="carousel"&gt;
          &lt;!-- Indicators --&gt;
          &lt;ol class="carousel-indicators"&gt;
            &lt;li data-target="#shopCarousel" data-slide-to="0" class="active"&gt;&lt;/li&gt;
            &lt;li data-target="#shopCarousel" data-slide-to="1"&gt;&lt;/li&gt;
            &lt;li data-target="#shopCarousel" data-slide-to="2"&gt;&lt;/li&gt;
          &lt;/ol&gt;
  
          &lt;!-- Wrapper for slides --&gt;
          &lt;div class="carousel-inner" role="listbox"&gt;
            &lt;div class="item active"&gt;
              &lt;img src="&lt;?echo base_url();?&gt;application/assets/images/shops/1.jpg" alt="..."&gt;
              &lt;div class="carousel-caption"&gt;
                ...
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="item"&gt;
              &lt;img src="&lt;?echo base_url();?&gt;application/assets/images/shops/2.jpg" alt="..."&gt;
              &lt;div class="carousel-caption"&gt;
                ...
              &lt;/div&gt;
            &lt;/div&gt;
  
            &lt;div class="item"&gt;
              &lt;img src="&lt;?echo base_url();?&gt;application/assets/images/shops/3.jpg" alt="..."&gt;
              &lt;div class="carousel-caption"&gt;
                ...
              &lt;/div&gt;
            &lt;/div&gt;
  
          &lt;/div&gt;
  </code></pre>
  
  <p>Now I place each image directly. I want showing the images of that particular shop, now shows the same images in all shops.</p>
  
  <p>I want this way, but images are not displayed.</p>