Reputation: 327
I use codeigniter as my framework and testing a site on a localhost. At the moment I am using img tags as the following:
<img src="<?php echo base_url(); ?>/assets/images/image.png" class="home"/>
This shows the image- great, but when validating html I get the following message:
"Character "<" is the first character of a delimiter but occurred as data This message may appear in several cases:
You should escape it as <
You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&", which is always safe.
Another possibility is that you forgot to close quotes in a previous tag.
I have also tried the Codeigniter html helper of the img tag array and when I do this it doesn't show the image and any code underneath this line does not show.
Any suggestions to mark this code better or a way of passing the validation checks as I like to be 100% pass rate.
Upvotes: 0
Views: 492
Reputation: 4637
Try using site_url
<img src="<?php echo site_url('/assets/images/image.png');?>" class="home"/>
Upvotes: 2
Reputation: 3289
please remove / at the end of the
base_url()
base_user function by default provides / at the end use this way
<img src="<?php echo base_url();?>assets/images/image.png" class="home"/>
Upvotes: 1