Tuesday, October 23, 2012

Re: Allow special characters in HtmlHelper

setting 'url' options in image can do the trick too.
 $this->Html->image($image['Image']['thumb_path'], array( 'alt' => $title ,'url' => $yoururl));

On Tuesday, 23 October 2012 12:08:13 UTC+8, bs28723 wrote:
I would like to use Html->image and Html->link together, but Html->link will convert characters like <, ", etc to htmlize them.

for example
            $imgTag = $this->Html->image($image['Image']['thumb_path'], array( 'alt' => $title ));
                $options = array('class' => 'thumb', 'name' => trim(Inflector::slug($title)), 'title' => trim($title));
               
           echo $this->Html->link($imgTag, $this->Html->url($image['Image']['small_path'],true), $options);

Will actually produce

<a href="/2d3cf4770eefa1244464b0371009c2b0_resized_250x188.jpg" class="thumb" name="tree" title="tree ">  &lt;img src=&quot;/2d3cf4770eefa1244464b0371009c2b0_resized_100x75.jpg&quot; alt=&quot;tree &quot; /&gt;</a>    Yes the &lt; etc is really in the file, so the image does not get recognized by the browser as HTML. But it just gets displayed as text.    Any way to get the Html->link to not convert the string?  Or do I need to just build this manually?  



View this message in context: Allow special characters in HtmlHelper
Sent from the CakePHP mailing list archive at Nabble.com.

--
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 cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: