On Thu, Mar 24, 2011 at 7:24 PM, adam_g2000 <[email protected]> wrote:
> Hi Guys,
>
> I'm using the following code:
>
> echo $this->Html->image('photos/' . $resource['Resource']['filename'],
> array(
>        'alt' => $resource['Resource']['title'],
>        'url' => array('controller' => 'resources', 'action' => 'lightbox',
> $resource['Resource']['filename_large'])
> ));
>
> What I need to do is make the resulting link have a 'rel' attribute so
> it ends up looking like...
>
> <a href="linketc..." rel="prettyPhoto"><img src="blah"></a>
>
> ...but I can't figure out from the documentation how to do it.

It looks like the image() method doesn't take that, or any other link
attributes, into consideration.
http://api.cakephp.org/view_source/html-helper/#line-604

I use link() plus image():

echo $this->Html->link(
        $this->Html->image(
                'photos/' . $resource['Resource']['filename'],
                array('alt' => $resource['Resource']['title'])
        ),
        array(
                'controller' => 'resources',
                'action' => 'lightbox',
                $resource['Resource']['filename_large']
        ),
        array(
                'rel' => 'prettyPhoto',
                'escape' => false
        )
);

Note the 'escape' option. If left out, the img tag will be escaped.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to