Welcome Guest, Not a member yet? Register   Sign In
image not appearing - disallowed character
#1

[eluser]Incito Networks[/eluser]
Hi All ,


Using Codeigniter and Twitter Bootstrap for a website.

For one of the pages the header and footer is using a view and the content is a html fetched from the database.

In this html I have an IMG tag for displaying an image on the page.

When I use this for the IMG tag it works:

Code:
<p><img  src="http://caferenaissance.com/CI/assets/img/events2.jpg"></p>

When I use this , it does NOT work:

Code:
<p><img  src="&lt;?php echo base_url(); ?&gt;assets/img/events2.jpg"></p>

However when the image does not appear and when I right click missing image and choose to show it in a new tab I get:

Code:
Disallowed Key Characters.

Looking at URL of this page it is:

Code:
http://caferenaissance.com/CI/content/&lt;?php echo base_url(); ?&gt;assets/img/events2.jpg

Any suggestions on what the problem could be ?

using the base_url() method above does seem to be working fine on other pages when I am not fetching the html content from the db.

Seems like it is doing some kind of URI validation before running the php bit to get the full URI.

Any suggestions on why this is happening ?
#2

[eluser]PhilTem[/eluser]
If you get your code from the database it is just code i.e. no PHP tags will be evaluated. That's why you will have the &lt;?php ... in the parsed html.

You either want to eval() the code (though it can be a pain in the somewhere to set it up and it is a security issue) or you use some sort of bbcode/markdown parser over the content from the DB.




Theme © iAndrew 2016 - Forum software by © MyBB