Welcome Guest, Not a member yet? Register   Sign In
Images not showing
#1

[eluser]Brovar[/eluser]
Heya.

I'm making a webcomic site, and i've run into a problem. I'm displaying comics, and you can browse between then as in every site that type. The problem is, that displaying latest comic works fine, but switching won't work. Here's the code:

Model:
Code:
<?php
class Comic_model extends CI_Model {

public function __construct()
{
  $this->load->database();
}
        public function get_comic($id = FALSE)
{
if ($id == FALSE)
{
  $this->db->select_max('ComicId');
                $query = $this->db->get('comic');
  $max = $query->row_array();
  $maxx = $max['ComicId'];
  $this->db->where('ComicId', $maxx);
  $query = $this->db->get('comic');
  return $query->row_array();
}
else
{
$query = $this->db->get_where('comic', array('ComicId' => $id));
return $query->row_array();
}
}

Controller:
Code:
<?php
class Comic extends CI_Controller {

public function __construct()
{
  parent::__construct();
  $this->load->model('comic_model');
}

public function index($id = FALSE)
{
                $this->load->helper('url');
                $this->load->helper('html');
  $data['comic'] = $this->comic_model->get_comic($id);
  $this->load->view('templates/header');
  $this->load->view('templates/main');
                $this->load->view('comic', $data);
                $this->load->view('templates/sidebar');
  $this->load->view('templates/footer');
  
}
        
}

View:

Code:
<div id="splash"><img src = "&lt;?php echo $comic['ComicUrl'] ?&gt;" height = "400" width = "600"></div>
<div id="comicmenu">
<ul>
  <li>&lt;?php echo anchor('comic',img('images/arrow_left2.jpg'));?&gt;</li>
  <li>&lt;?php echo anchor('comic/index/8',img('images/arrow_left.jpg'));?&gt;</li>
  <li>&lt;?php echo anchor('comic/index/9',img('images/arrow_right.jpg'));?&gt;</li>
  <li>&lt;?php echo anchor('comic',img('images/arrow_right2.jpg'));?&gt;</li>
  &lt;?php echo $comic['ComicUrl'];?&gt;
</ul>
        
</div>

As you see, if there is no id present, it just takes latest entry into database via get_max and displays it. Otherwise it returns an entry with corresponding id. The links are hardcoded for testing purposes.

The problem is, that when i go through webcomic/comic it works fine, but if i use webcomic/comic/index or webcomic/comic/index/$id it won't display the image. Curious thing is that proper database entry is actually passed to view. I double checked it via echo and the end of the view, and also if i go to source code, it actually shows identical img src as when going without id ( but of course with different entry ).

Any ideas?


Messages In This Thread
Images not showing - by El Forum - 02-24-2012, 05:09 PM
Images not showing - by El Forum - 02-24-2012, 08:48 PM
Images not showing - by El Forum - 02-25-2012, 01:27 AM
Images not showing - by El Forum - 02-27-2012, 09:31 AM
Images not showing - by El Forum - 02-27-2012, 10:54 AM
Images not showing - by El Forum - 02-27-2012, 02:36 PM
Images not showing - by El Forum - 02-27-2012, 02:45 PM
Images not showing - by El Forum - 02-27-2012, 03:15 PM
Images not showing - by El Forum - 02-27-2012, 03:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB