Re: Help with linked image swap

2009-02-14 Thread Zolthar

Hi Brian, will give this a try and thanks heaps on the heads up and
alterations.


On Feb 9, 3:15 pm, brian  wrote:
> On Sun, Feb 8, 2009 at 10:38 PM, Zolthar  wrote:
>
> > Thanks for the explanation - looks like I jumped into waters deeper
> > than I first thought.
>
> > I did the first part, although where do I modify the 'isset' attribute
> > as you said above?
>
> You want to modify the UNSET line. It's in the HtmlHelper::link
> method. Look in cake/libs/view/helpers/html.php around line 290. The
> unset() was added, I think, as a bit of housecleaning. Except the
> option is still very much useful after that line. Just comment it.
>
> However, be aware that doing so might void your warranty. YMMV.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with linked image swap

2009-02-08 Thread brian

On Sun, Feb 8, 2009 at 10:38 PM, Zolthar  wrote:
>
> Thanks for the explanation - looks like I jumped into waters deeper
> than I first thought.
>
> I did the first part, although where do I modify the 'isset' attribute
> as you said above?
>

You want to modify the UNSET line. It's in the HtmlHelper::link
method. Look in cake/libs/view/helpers/html.php around line 290. The
unset() was added, I think, as a bit of housecleaning. Except the
option is still very much useful after that line. Just comment it.

However, be aware that doing so might void your warranty. YMMV.

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with linked image swap

2009-02-08 Thread Zolthar

Thanks for the explanation - looks like I jumped into waters deeper
than I first thought.

I did the first part, although where do I modify the 'isset' attribute
as you said above?




On Feb 8, 4:37 am, brian  wrote:
> The last param, false, tells Cake to not escape the "title" (your
> image, in this case). But you need to pass an 'escape' option in
> $htmlAttributes to keep them from being escaped, also.
>
> echo $html->link(
>         $html->image('navigation/nlOn-curved.gif'),
>         'http://www.external.com',
>         array(
>                 'onmousever'=>'changeImages("nav01", 
> "images/nlOn-curved.gif");return true;',
>                 'escape' => false
>         ),
>         null, false
> );
>
> HOWEVER, there seems to be a bug in HtmlHelper, which I've posted to Trac. [1]
>
> I think the Cake devs are trying to move as many params as possible
> into array options, so that they may easily be handed down the chain
> of methods. In this case, the link() method checks for that false
> param to see if the title requires escaping, but it also looks in
> $htmlAttributes for an escape option. If it's there, the title is also
> escaped.
>
> The problem, though, is that the option is then unset before the array
> is handed off to create the link attributes. The fix is to comment the
> unset() line:
>
> if (isset($htmlAttributes['escape'])) {
>         $escapeTitle = $htmlAttributes['escape'];
>         //unset($htmlAttributes['escape']);
>
> }
>
> I guess the reasoning was that the 'escape' option was no longer
> needed. But that fails to recognise that this option already had a
> purpose before it was drafted into service controlling the escaping of
> the link text ($title).
>
> [1]https://trac.cakephp.org/ticket/6071
>
> On Sat, Feb 7, 2009 at 2:15 AM, Zolthar  wrote:
>
> > Thanks for the update, I had tried something similar, although did not
> > succeed as quotes were converted to ".
>
> > Here is what I attempted:
> >                link(
> >                                $html->image('navigation/nlOn-curved.gif'),
> >                                'http://www.external.com',
> >                                array(
> >                                        'onmousever'=>'changeImages("nav01", 
> > "images/nlOn-curved.gif");
> > return true;'
> >                                        ),
> >                                null, false) ?>
>
> > Although the above turned out to be:
> > http://www.external.com"; onmousever="changeImages
> > ("nav01", "images/nlOn-curved.gif"); return
> > true;">
>
> > So I must be missing something here. Is there a way to force or escape
> > the quote to be literal as opposed to being converted?
>
> > On Feb 7, 4:10 pm, Simz  wrote:
> >> use the html helper 
> >> :http://book.cakephp.org/view/206/Inserting-Well-Formatted-elements
>
> >> image(string $path, array $htmlAttributes = array())
>
> >> in your view (inside a php block)
>
> >> echo $html->image(
> >>     "menu1.jpg",
> >>     array(
> >>         "onmouseover"=­>"yourJsRollOverFunc()",
> >>         "onclick"=>"jsFunc()",
> >>         "class"=>"mycssclass"
> >>     )
> >> );
>
> >> wrap the php block with your link...
> >> this should do the trick
>
> >> On Feb 6, 10:14 pm, Zolthar  wrote:
>
> >> > Learning cake/programming for the first time so please excuse me if
> >> > this is a very noob question. I have tried to search this board
> >> > without much success - as the responses were either too complicated or
> >> > possibly I searching with the wrong keywords.
>
> >> > What I am after is how do I get a linked image to swap like
> >> > onmouseover using javascripts (or any other option)?
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with linked image swap

2009-02-07 Thread brian

The last param, false, tells Cake to not escape the "title" (your
image, in this case). But you need to pass an 'escape' option in
$htmlAttributes to keep them from being escaped, also.

echo $html->link(
$html->image('navigation/nlOn-curved.gif'),
'http://www.external.com',
array(
'onmousever'=>'changeImages("nav01", 
"images/nlOn-curved.gif");return true;',
'escape' => false
),
null, false
);

HOWEVER, there seems to be a bug in HtmlHelper, which I've posted to Trac. [1]

I think the Cake devs are trying to move as many params as possible
into array options, so that they may easily be handed down the chain
of methods. In this case, the link() method checks for that false
param to see if the title requires escaping, but it also looks in
$htmlAttributes for an escape option. If it's there, the title is also
escaped.

The problem, though, is that the option is then unset before the array
is handed off to create the link attributes. The fix is to comment the
unset() line:

if (isset($htmlAttributes['escape'])) {
$escapeTitle = $htmlAttributes['escape'];
//unset($htmlAttributes['escape']);
}

I guess the reasoning was that the 'escape' option was no longer
needed. But that fails to recognise that this option already had a
purpose before it was drafted into service controlling the escaping of
the link text ($title).

[1] https://trac.cakephp.org/ticket/6071

On Sat, Feb 7, 2009 at 2:15 AM, Zolthar  wrote:
>
> Thanks for the update, I had tried something similar, although did not
> succeed as quotes were converted to ".
>
> Here is what I attempted:
>link(
>$html->image('navigation/nlOn-curved.gif'),
>'http://www.external.com',
>array(
>'onmousever'=>'changeImages("nav01", 
> "images/nlOn-curved.gif");
> return true;'
>),
>null, false) ?>
>
> Although the above turned out to be:
> http://www.external.com"; onmousever="changeImages
> ("nav01", "images/nlOn-curved.gif"); return
> true;">
>
> So I must be missing something here. Is there a way to force or escape
> the quote to be literal as opposed to being converted?
>
>
>
>
> On Feb 7, 4:10 pm, Simz  wrote:
>> use the html helper 
>> :http://book.cakephp.org/view/206/Inserting-Well-Formatted-elements
>>
>> image(string $path, array $htmlAttributes = array())
>>
>> in your view (inside a php block)
>>
>> echo $html->image(
>> "menu1.jpg",
>> array(
>> "onmouseover"=­>"yourJsRollOverFunc()",
>> "onclick"=>"jsFunc()",
>> "class"=>"mycssclass"
>> )
>> );
>>
>> wrap the php block with your link...
>> this should do the trick
>>
>> On Feb 6, 10:14 pm, Zolthar  wrote:
>>
>> > Learning cake/programming for the first time so please excuse me if
>> > this is a very noob question. I have tried to search this board
>> > without much success - as the responses were either too complicated or
>> > possibly I searching with the wrong keywords.
>>
>> > What I am after is how do I get a linked image to swap like
>> > onmouseover using javascripts (or any other option)?
>
> >
>

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with linked image swap

2009-02-07 Thread Zolthar

Thanks for the update, I had tried something similar, although did not
succeed as quotes were converted to ".

Here is what I attempted:
link(
$html->image('navigation/nlOn-curved.gif'),
'http://www.external.com',
array(
'onmousever'=>'changeImages("nav01", 
"images/nlOn-curved.gif");
return true;'
),
null, false) ?>

Although the above turned out to be:
http://www.external.com"; onmousever="changeImages
("nav01", "images/nlOn-curved.gif"); return
true;">

So I must be missing something here. Is there a way to force or escape
the quote to be literal as opposed to being converted?




On Feb 7, 4:10 pm, Simz  wrote:
> use the html helper 
> :http://book.cakephp.org/view/206/Inserting-Well-Formatted-elements
>
> image(string $path, array $htmlAttributes = array())
>
> in your view (inside a php block)
>
> echo $html->image(
>     "menu1.jpg",
>     array(
>         "onmouseover"=­>"yourJsRollOverFunc()",
>         "onclick"=>"jsFunc()",
>         "class"=>"mycssclass"
>     )
> );
>
> wrap the php block with your link...
> this should do the trick
>
> On Feb 6, 10:14 pm, Zolthar  wrote:
>
> > Learning cake/programming for the first time so please excuse me if
> > this is a very noob question. I have tried to search this board
> > without much success - as the responses were either too complicated or
> > possibly I searching with the wrong keywords.
>
> > What I am after is how do I get a linked image to swap like
> > onmouseover using javascripts (or any other option)?

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with linked image swap

2009-02-06 Thread Simz

use the html helper : 
http://book.cakephp.org/view/206/Inserting-Well-Formatted-elements

image(string $path, array $htmlAttributes = array())

in your view (inside a php block)

echo $html->image(
"menu1.jpg",
array(
"onmouseover"=­>"yourJsRollOverFunc()",
"onclick"=>"jsFunc()",
"class"=>"mycssclass"
)
);

wrap the php block with your link...
this should do the trick

On Feb 6, 10:14 pm, Zolthar  wrote:
> Learning cake/programming for the first time so please excuse me if
> this is a very noob question. I have tried to search this board
> without much success - as the responses were either too complicated or
> possibly I searching with the wrong keywords.
>
> What I am after is how do I get a linked image to swap like
> onmouseover using javascripts (or any other option)?
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---