& is automatically turned into & !?
I have a little problem. On my pagetype I want to print a dynamic image, lets say in this form: <img src="anyurl/img.php?a=b&c=d">
But when I echo this, it automatically transfers the '&' into a '&' which will destroy the img-link and not display it (instead showing the alt-Text for the img).
How can I prevent that the & gets automatically replaced by & for this one line?
That doesn't help, I tried both of this:
<?php (...) echo '&'; (...) ?>
<?php (...) ?> & <?php (...) ?>
In both cases it will print a & amp; and therefor destroy my dynamic links..
Any other idea? :(
Does concrete5 somehow convert all htmlentities? Any way to skip that for certain lines or files?
However the result for the image is a HTTP 400 Bad Request. When I copy the URL from the webconsole to the address bar it can load the image though.
So I guess the request is done with the & amp; instead of & and it will only display it correctly in the console. (Because 400 Bad Request is exactl what I get if I put & amp; instead of & to the URL and browse it manually)
So the problem remains :(
I am no PHP expert (trust me!), but a little Googling about URL encoding of HTML characters and I came across 2 different PHP functions that you may be able to use on your generated image source URL:
I don't know about the specifics of either one, but maybe if you wrap the src URL for your image in one or the other of these functions it will work correctly for you.
Hope that helps!
The problem is probably that the & gets converted into a & ; after all the php file is executed. I don't know how concrete5 buffers the output, but I can say that I don't really like it. Either it's just missing a decent documentation or it's not optimized at all. I'm a little bit disappointed in concrete5 at this point.
Anyways thank you for trying to help me :)
I just forgot to use the code block in the first post. Didn't know that the forums would eat the HTML entities.
Edit: omg even in the code block the forums ruin my format.. This:http://pastebin.com/zSphkiH5
And how do you print out the link?
Please paste like 10 lines on both sides of the code to see it really in context and also the whole HTML source that the page request produces.