CodeIgniter Forums
It works but is it the correct way? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1)
+--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3)
+--- Thread: It works but is it the correct way? (/showthread.php?tid=71167)



It works but is it the correct way? - dreamweaver - 07-15-2018

"<?php echo site_url('uploads/'); echo $horse->picture; ?>">


RE: It works but is it the correct way? - InsiteFX - 07-15-2018

Yes, and if you want do links see the User Guide on anchor


RE: It works but is it the correct way? - Pertti - 07-15-2018

(07-15-2018, 03:48 AM)dreamweaver Wrote: "<?php echo site_url('uploads/'); echo $horse->picture; ?>">

If you are trying to link to image or css file, it's better to use base_url() function.

site_url will include or exclude index.php, depending on your setup.

In my opinion, it's also better to add everything as function argument, not adding it to later.

Code:
<img src="<?php echo base_url('uploads/'.$horse->picture); ?>">