title: syntax error, unexpected 'endforeach' (T_ENDFOREACH), expecting end of file (in my slider view - carousel)
body: <p>I don't know what to do, my index page doesn't work... I mean it working perfectly before I add function slider that already connect to database... What must I do?</p>
  
  <blockquote>
    <p>An uncaught Exception was encountered</p>
    
    <p>Type: ParseError</p>
    
    <p>Message: syntax error, unexpected 'endforeach' (T_ENDFOREACH),
    expecting end of file</p>
    
    <p>Filename: C:\xampp\htdocs\eat\application\views\front\index.php</p>
    
    <p>Line Number: 96</p>
    
    <p>Backtrace:</p>
    
    <p>File: C:\xampp\htdocs\eat\application\controllers\index.php Line: 15
    Function: view</p>
    
    <p>File: C:\xampp\htdocs\eat\index.php Line: 315 Function: require_once</p>
  </blockquote>
  
  <p>view: index.php</p>
  
  <pre><code>&lt;!--- Carousel --&gt; 
  &lt;div id="myCarousel" class="carousel slide" data-ride="carousel"&gt;
                  &lt;div class="carousel-inner"&gt;
                      &lt;?php foreach ($slider as $slider) ?&gt;
                      &lt;div class="item-active"&gt;
                          &lt;img src="&lt;?php echo base_url('upload/banner/'.$banner-&gt;image)?&gt;"&gt;
                          &lt;div class="carousel-caption"&gt;
                              &lt;h3&gt;&lt;?=$slider-&gt;name?&gt;&lt;/h3&gt;
                              &lt;p&gt;&lt;?=$slider-&gt;description?&gt;&lt;/p&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="item"&gt;
                          &lt;img src="&lt;?php echo base_url('upload/banner/'.$banner-&gt;image)?&gt;"&gt;
                          &lt;div class="carousel-caption"&gt;
                              &lt;h3&gt;&lt;?=$slider-&gt;name?&gt;&lt;/h3&gt;
                              &lt;p&gt;&lt;?=$slider-&gt;dekripsi?&gt;&lt;/p&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;a class="left carousel-control" href="#myCarousel" data-slide="prev"&gt;
                      &lt;span class="glyphicon glyphicon-chevron-left"&gt;&lt;/span&gt;
                      &lt;span class="sr-only"&gt; previous&lt;/span&gt;
                  &lt;/a&gt;
                  &lt;a class="right carousel-control" href="=#myCarousel" data-slide="next"&gt;
                      &lt;span class="glyphicon glyphicon-chevron-right"&gt;&lt;/span&gt;
                      &lt;span class="sr-only"&gt; next &lt;/span&gt; 
                  &lt;/a&gt;
              &lt;/div&gt;
              &lt;?php endforeach; ?&gt; 
  </code></pre>
  
  <p>controller: index.php</p>
  
  <pre><code>&lt;?php defined('BASEPATH') OR exit('No direct script access allowed');
  
  class Index extends CI_Controller {
  
      public function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;model("Indexweb_model");
          $this-&gt;load-&gt;library('form_validation');
      }
  
      public function index()
      {
          $data["slider"] = $this-&gt;Indexweb_model-&gt;getAll();
          $this-&gt;load-&gt;view("front/index", $data);
      }
  }
  </code></pre>
  
  <p>model: Indexweb_model.php</p>
  
  <pre><code>&lt;?php defined('BASEPATH') OR exit('No direct script access allowed');
  
  class Indexweb_model extends CI_Model
  {
      private $_table = "slider";
  
      public $id_slider;
      public $name;
      public $deskripsi;
      public $image;
  
      public function rules()
      {
          return [
              ['field' =&gt; 'name',
              'label' =&gt; 'Name',
              'rules' =&gt; 'required']
          ];
      }
  
      public function getAll()
      {
          return $this-&gt;db-&gt;get($this-&gt;_table)-&gt;result();
      }
  
      public function getById($id)
      {
          return $this-&gt;db-&gt;get_where($this-&gt;_table, ["id_slider" =&gt; $id])-&gt;row();
      }
  
      public function save()
      {
          $post = $this-&gt;input-&gt;post();
  //      $this-&gt;id_slider = uniqid();
          $this-&gt;name = $post["name"];
          $this-&gt;deskripsi = $post["deskripsi"];
          $this-&gt;image = $this-&gt;_uploadImage();
          $this-&gt;db-&gt;insert($this-&gt;_table, $this);
      }
  
      public function update()
      {
          $post = $this-&gt;input-&gt;post();
          $this-&gt;id_slider = $post["id"];
          $this-&gt;name = $post["name"];
          $this-&gt;deskripsi = $post["deskripsi"];
          if (!empty($_FILES["image"]["name"])) {
              $this-&gt;image = $this-&gt;_uploadImage();
          } else {
              $this-&gt;image = $post["old_image"];
          }
          $this-&gt;db-&gt;update($this-&gt;_table, $this, array('id_slider' =&gt; $post['id']));
      }
  
      public function delete($id)
      {
          $this-&gt;_deleteImage($id);
          return $this-&gt;db-&gt;delete($this-&gt;_table, array("id_slider" =&gt; $id));
      }
  
      private function _uploadImage()
      {
          $config['upload_path']          = './upload/slider/';
          $config['allowed_types']        = 'gif|jpg|png|jpeg';
          $config['upload_max_filesize']  = '100000M';
          $config['post_max_size']        = '100000M';
          $config['file_name']            = basename($_FILES["image"]["name"]);
          $config['overwrite']            = true;
  
          $this-&gt;load-&gt;library('upload', $config);
  
          if ($this-&gt;upload-&gt;do_upload('image')) {
              return $this-&gt;upload-&gt;data("file_name");
          }
      }
  
      private function _deleteImage($id)
      {
          $slider = $this-&gt;getById($id);
          if ($slider-&gt;image != "default.jpg") {
              $filename = explode(".", $slider-&gt;image)[0];
              return array_map('unlink', glob(FCPATH."upload/slider/$filename.*"));
          }
      }
  
  }
  </code></pre>