Ok, I think I found a suitable way by doing something else :). I came about 
to this idea when I had to make some <i> elements to my site and figured 
out that I can use that for the image problem too.

*You can do it by using the HtmlHelpers tag-function: *

$this->Html->tag('img', null, array('src' => 
'http://static.site.com/image.png', 'alt' => 'alt text))


Hopefully this helps other as well, that haven't used the tag-function 
before :).



On Tuesday, November 6, 2012 1:10:34 PM UTC+2, Henry Flink wrote:
>
> My problem is quite simple: How do I  create <img>-tags with an external 
> url using cakephp's htmlhelper ? I have a site that hosts all static 
> content, such as images and javascripts and I need to use it's address on 
> my sites.
>
> *CASE*
> Lets assume my cake is running at http://www.mysite.com/caek/
>
> My view code is like this (i'll seperate the variables for easier reading)
> <code>
> <?php
>     $address="http://static.site.com/image.png";; //this variable will 
> come from controller.
>     echo $this->Html->image($address, array('alt' => 'alt text'));
> ?>
> </code>
>
> This will output something like this: <img src="caek/
> http://static.site.com/image.png"; alt="alt text" /> .
>
> While what I want is: <img src="http://static.site.com/image.png"; 
> alt="alt text" /> .
>
>
> I could do this by echoing the right tags and such with the variables, but 
> I'm in a state of mind that I want to solve the problem, instead of going 
> around it.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to