• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weird behavior with segments

I am working on a controller that is used in an email confirmation. The email is a link that contains the id of the confirmation record. What happens is that I take the segments and parse them to execute the email confirmation. When the link is first called and processed by the controller the email is confirmed. The weird behavior is that after the first round the page tries to load a few images in the view. Each of those image loads also somehow get routed through the same controller. In firebug I can see that images are trying to load from a new_images folder. This folder doesn't exist and I also searched the code for new_images and it came up empty. Any ideas on what could be happening?

Sounds like you are calling your images with a relative path, and not an absolute path.

If you prefix your image src attribute with a forward slash, it should start working.

<img src="/images/some_image.gif" alt="Some image" />

Alternatively, you can use base_url() to generate an absolute URL for your images.

&lt;img src="&lt;?php echo base_url() . 'images/some_image.gif'); ?&gt;" alt="Some image" />

But you will need to have loaded the URL helper:

The second method is probably the best route to take.

TheFuzzy0ne it's best to use base_url because site_url can generate full urls like this : http://site.com/index.php/images/some_image.gif. This depends on whether the index_page setting has an empty string or not.

My bad. I've changed the information. to reflect that. Thanks for pointing it out.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.