Re: Using Javascript->link Inside An Element

2010-06-08 Thread calvin
I know, it sucks. I think I did manage to achieve a similar result in
a very roundabout way in one of my older applications, but it's not
really worth the hassle; Cake just isn't set up for it.

On Jun 8, 7:15 am, Dima  wrote:
> My original implementation did exactly what you describe but I was
> hoping that it could be done otherwise.  Guess not.
>
> Thanks,
> Dima
>
> On Jun 7, 8:12 pm, calvin  wrote:
>
> > You only use echo when you're linking them inline. So you would never
> > have something like:
>
> > echo $javascript->link($scriptname, false);
>
> > It would either be:
>
> > echo $javascript->link($scriptname);
>
> > or:
>
> > $javascript->link($scriptname, false);
>
> > Unfortunately, you can't use the $scripts_for_layout variable in the
> > layout or elements included from the layout because usually by that
> > point the variable has already been printed out.
>
> > Your best bet would be to just place inline link calls in the header
> > section of the layout.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Using Javascript->link Inside An Element

2010-06-08 Thread Dima
My original implementation did exactly what you describe but I was
hoping that it could be done otherwise.  Guess not.

Thanks,
Dima

On Jun 7, 8:12 pm, calvin  wrote:
> You only use echo when you're linking them inline. So you would never
> have something like:
>
> echo $javascript->link($scriptname, false);
>
> It would either be:
>
> echo $javascript->link($scriptname);
>
> or:
>
> $javascript->link($scriptname, false);
>
> Unfortunately, you can't use the $scripts_for_layout variable in the
> layout or elements included from the layout because usually by that
> point the variable has already been printed out.
>
> Your best bet would be to just place inline link calls in the header
> section of the layout.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Using Javascript->link Inside An Element

2010-06-07 Thread calvin
You only use echo when you're linking them inline. So you would never
have something like:

echo $javascript->link($scriptname, false);

It would either be:

echo $javascript->link($scriptname);

or:

$javascript->link($scriptname, false);

Unfortunately, you can't use the $scripts_for_layout variable in the
layout or elements included from the layout because usually by that
point the variable has already been printed out.

Your best bet would be to just place inline link calls in the header
section of the layout.

On Jun 7, 2:51 pm, Dima  wrote:
> vekija, thanks a ton for your help!!  I added echo in front of all 4
> of the lines in nav_menu.cpt.  I was immediately able to see the style
> sheets kick in; however, when I look at page source, it still doesn't
> show those files in the page header and is not displaying correctly.
> Am I using the  correctly?  Does it
> have to go before/after a certain point in the header?
>
> Thanks again,
> Dima
>
> On Jun 7, 4:10 pm, vekija  wrote:
>
> > you have to "echo" those :)
>
> > echo $javascript->link('mootools-for-dropdown', false);
>
> > On Jun 7, 8:43 pm, Dima  wrote:
>
> > > I'm pretty new to CakePHP so it is likely that my issue is rather
> > > simple to fix.  I have a custom element which I created called
> > > nav_menu.cpt.  I call this element from default.cpt using:
>
> > > element('nav_menu'); ?>
>
> > > For my element to work properly, I need to import 3x .js files and
> > > 1x .css file; I have placed these files in /webroot/js/ and /webroot/
> > > css/ respectively and am attempting to call them inside the element
> > > like so:
>
> > >  > > $javascript->link('mootools-for-dropdown', false);
> > > $javascript->link('UvumiDropdown-compressed', false);
> > > $javascript->link('nav_menu', false);
> > > $html->css('uvumi-dropdown');
> > > ?>
>
> > > However, when the page loads and I check page source, it doesn't
> > > include these files in the header.  I've also tried calling this
> > > following line in default.cpt with no success:
>
> > > 
>
> > > What am I doing wrong??
>
> > > Thanks,
> > > Dima

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Using Javascript->link Inside An Element

2010-06-07 Thread Dima
vekija, thanks a ton for your help!!  I added echo in front of all 4
of the lines in nav_menu.cpt.  I was immediately able to see the style
sheets kick in; however, when I look at page source, it still doesn't
show those files in the page header and is not displaying correctly.
Am I using the  correctly?  Does it
have to go before/after a certain point in the header?

Thanks again,
Dima

On Jun 7, 4:10 pm, vekija  wrote:
> you have to "echo" those :)
>
> echo $javascript->link('mootools-for-dropdown', false);
>
> On Jun 7, 8:43 pm, Dima  wrote:
>
> > I'm pretty new to CakePHP so it is likely that my issue is rather
> > simple to fix.  I have a custom element which I created called
> > nav_menu.cpt.  I call this element from default.cpt using:
>
> > element('nav_menu'); ?>
>
> > For my element to work properly, I need to import 3x .js files and
> > 1x .css file; I have placed these files in /webroot/js/ and /webroot/
> > css/ respectively and am attempting to call them inside the element
> > like so:
>
> >  >         $javascript->link('mootools-for-dropdown', false);
> >         $javascript->link('UvumiDropdown-compressed', false);
> >         $javascript->link('nav_menu', false);
> >         $html->css('uvumi-dropdown');
> > ?>
>
> > However, when the page loads and I check page source, it doesn't
> > include these files in the header.  I've also tried calling this
> > following line in default.cpt with no success:
>
> > 
>
> > What am I doing wrong??
>
> > Thanks,
> > Dima

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Using Javascript->link Inside An Element

2010-06-07 Thread vekija
you have to "echo" those :)

echo $javascript->link('mootools-for-dropdown', false);

On Jun 7, 8:43 pm, Dima  wrote:
> I'm pretty new to CakePHP so it is likely that my issue is rather
> simple to fix.  I have a custom element which I created called
> nav_menu.cpt.  I call this element from default.cpt using:
>
> element('nav_menu'); ?>
>
> For my element to work properly, I need to import 3x .js files and
> 1x .css file; I have placed these files in /webroot/js/ and /webroot/
> css/ respectively and am attempting to call them inside the element
> like so:
>
>          $javascript->link('mootools-for-dropdown', false);
>         $javascript->link('UvumiDropdown-compressed', false);
>         $javascript->link('nav_menu', false);
>         $html->css('uvumi-dropdown');
> ?>
>
> However, when the page loads and I check page source, it doesn't
> include these files in the header.  I've also tried calling this
> following line in default.cpt with no success:
>
> 
>
> What am I doing wrong??
>
> Thanks,
> Dima

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Using Javascript link

2009-08-12 Thread brian

Sorry, I forgot to get back to you; I was in the middle of a crisis.

cake/../img/picturename.gif

That path doesn't look right. I think there's something deeper wrong.

And what about that  in your view? Is it so, or is that actually
in your layout?

And, what I meant about rollovers is that, when you do:

element.src = "images/mesogamesHover.gif";

... you're forcing the script to download the image as the user hovers
over the link. So you're bound to see some lag. It's better to preload
them in some way. By creating image objects and assigning a src to
them, the script will download the images to the client. Then in your
rollover function, you assign the src of the relevant Image object to
your element. The swap will happen immediately.

On Wed, Aug 12, 2009 at 3:12 PM, Sarah wrote:
>
> Nevermind, I finally figured out the location of the images.
>
> I set the 'address' of the alt pictures to:
>
> cake/../img/picturename.gif
>
> so it would have been:
> element.src = cake/../img/picturename.gif
>
> :)
>
> >
>

--~--~-~--~~~---~--~~
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: Using Javascript link

2009-08-12 Thread Sarah

Nevermind, I finally figured out the location of the images.

I set the 'address' of the alt pictures to:

cake/../img/picturename.gif

so it would have been:
element.src = cake/../img/picturename.gif

:)

--~--~-~--~~~---~--~~
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: Using Javascript link

2009-08-11 Thread Sarah

My original javascript code actually worked on a site (no setup with
cakephp).  The problem I'm having is linking everything together.  I
do appreciate the advice w/ the javascript though.  :)
--~--~-~--~~~---~--~~
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: Using Javascript link

2009-08-10 Thread Sarah

Thank you for your reply.

I don't fully understand your advice.

I understand that HtmlHelper will expect a relative path from webroot/
img, but if it is already in the 'img' folder, why would I need to
pass '/img/' + filename ?  Will the javascript code look for the Hover
images in the img folder?  Or will it look for it in the js folder?

You recommend that I create the image objects and then set element.src
= foo.src ?  (Just wanting to clarify what you mean).

Thank you very much for your help.
I hope to hear back.

Thanks,
~Sarah

On Aug 9, 8:20 pm, brian  wrote:
> You have a  in your view? No the layout? Does the HTML source look 
> right?
>
> Anyway, your onHover function won't work because you're not passing
> the full path to the image. Remember that HtmlHelper expectes a
> relative path from webroot/img. However, you're only passing the
> filename, instead of '/img/'+filename.
>
> Also, if you're going to do your rollovers like this, you'd be better
> off preloading them by creating Image objects and assigning the src to
> them. eg.
>
> var foo = new Image();
> foo.src = '/img/foo.gif';
> var foo_hover = new Image();
> foo_hover.src = '/img/foo_hover.gif';
>
> In reality, it'd be better t create an array of those. Pass the name
> or key, plus the stat--on or off--to your function, where you swap
> element.src with src of whichever Image is required.
>
> On Sun, Aug 9, 2009 at 8:09 PM, Sarah wrote:
>
> > I assume you want only the relevant parts.
>
> > In my view I have:
>
> > 
> >        
> >    Animal Tlatoque
> >    link('evoicesindex'); ?>
> >    css('evoices'); ?>
> >  
>
> >    
> >        link($html->image('Library3Sized.gif', array
> > ('alt'=>'Library', 'onmouseover'=>'onHover(this)',
> > 'onmouseout'=>'onUnHover(this)')), array('controller'=>'evoices',
> > 'action'=>'library'), array('escape'=>false)); ?>
> >    
>
> > Then I use it like so (I have an onUnHover written too )in my
> > evoicesindex.js which is located in webroot/js
>
> > function onHover(element){
>
> >    if(element.alt == "Games")
> >        element.src = "images/mesogamesHover.gif";
>
> >    if(element.alt == "House")
> >        element.src = "images/mesohouseHover.gif";
>
> >    if(element.alt == "Library")
> >        element.src = "Library3Sized.gif";
>
> >    if(element.alt == "Adventure Game")
> >        element.src = "images/forestHover.gif";
>
> >    if(element.alt == "School House")
> >        element.src = "images/mesoschoolHover1.gif";
>
> > }
>
> > Please let me know if I should just post the whole files...
>
> > Thanks for you help,
> > ~S
--~--~-~--~~~---~--~~
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: Using Javascript link

2009-08-09 Thread brian

You have a  in your view? No the layout? Does the HTML source look right?

Anyway, your onHover function won't work because you're not passing
the full path to the image. Remember that HtmlHelper expectes a
relative path from webroot/img. However, you're only passing the
filename, instead of '/img/'+filename.

Also, if you're going to do your rollovers like this, you'd be better
off preloading them by creating Image objects and assigning the src to
them. eg.

var foo = new Image();
foo.src = '/img/foo.gif';
var foo_hover = new Image();
foo_hover.src = '/img/foo_hover.gif';

In reality, it'd be better t create an array of those. Pass the name
or key, plus the stat--on or off--to your function, where you swap
element.src with src of whichever Image is required.

On Sun, Aug 9, 2009 at 8:09 PM, Sarah wrote:
>
> I assume you want only the relevant parts.
>
> In my view I have:
>
> 
>        
>    Animal Tlatoque
>    link('evoicesindex'); ?>
>    css('evoices'); ?>
>  
>
>
>    
>        link($html->image('Library3Sized.gif', array
> ('alt'=>'Library', 'onmouseover'=>'onHover(this)',
> 'onmouseout'=>'onUnHover(this)')), array('controller'=>'evoices',
> 'action'=>'library'), array('escape'=>false)); ?>
>    
>
> Then I use it like so (I have an onUnHover written too )in my
> evoicesindex.js which is located in webroot/js
>
> function onHover(element){
>
>    if(element.alt == "Games")
>        element.src = "images/mesogamesHover.gif";
>
>    if(element.alt == "House")
>        element.src = "images/mesohouseHover.gif";
>
>    if(element.alt == "Library")
>        element.src = "Library3Sized.gif";
>
>    if(element.alt == "Adventure Game")
>        element.src = "images/forestHover.gif";
>
>    if(element.alt == "School House")
>        element.src = "images/mesoschoolHover1.gif";
>
> }
>
> Please let me know if I should just post the whole files...
>
> Thanks for you help,
> ~S
>
> >
>

--~--~-~--~~~---~--~~
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: Using Javascript link

2009-08-09 Thread Sarah

I assume you want only the relevant parts.

In my view I have:



Animal Tlatoque
link('evoicesindex'); ?>
css('evoices'); ?>
  



link($html->image('Library3Sized.gif', array
('alt'=>'Library', 'onmouseover'=>'onHover(this)',
'onmouseout'=>'onUnHover(this)')), array('controller'=>'evoices',
'action'=>'library'), array('escape'=>false)); ?>


Then I use it like so (I have an onUnHover written too )in my
evoicesindex.js which is located in webroot/js

function onHover(element){

if(element.alt == "Games")
element.src = "images/mesogamesHover.gif";

if(element.alt == "House")
element.src = "images/mesohouseHover.gif";

if(element.alt == "Library")
element.src = "Library3Sized.gif";

if(element.alt == "Adventure Game")
element.src = "images/forestHover.gif";

if(element.alt == "School House")
element.src = "images/mesoschoolHover1.gif";

}

Please let me know if I should just post the whole files...

Thanks for you help,
~S

--~--~-~--~~~---~--~~
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: Using Javascript link

2009-08-09 Thread Vijay Kumbhar
Hello Sarah,

Can you please paste the code here so that we can help you right a
way.

On Sun, Aug 9, 2009 at 9:38 PM, brian  wrote:

>
> It could be a lot of things. Can you post your code?
>
> On Sat, Aug 8, 2009 at 9:32 PM, Sarah wrote:
> >
> > I'm having trouble getting my javascript to work.
> >
> > The api recommends using link and putting the scripts and contents
> > into the webroot/js folder.  I tried this, but it isn't working.
> >
> > I'm trying to create a hover for an image...I included the functions
> > in the second parameter of $html->image().
> >
> > Is there something I'm missing?
> >
> > I would appreciate any advice.
> >
> > Thanks,
> > ~S
> > >
> >
>
> >
>


-- 
Thanks & Regards,
Vijayk.
Co-founder (www.weboniselab.com)

"You Bring the Dreams, We'll Bring the Means"

--~--~-~--~~~---~--~~
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: Using Javascript link

2009-08-09 Thread Vijay Kumbhar
Hello Sarah,

Can you please paste your code here so that we can help you right a way.
With out telling the pros & cons for that...

On Sun, Aug 9, 2009 at 9:38 PM, brian  wrote:

>
> It could be a lot of things. Can you post your code?
>
> On Sat, Aug 8, 2009 at 9:32 PM, Sarah wrote:
> >
> > I'm having trouble getting my javascript to work.
> >
> > The api recommends using link and putting the scripts and contents
> > into the webroot/js folder.  I tried this, but it isn't working.
> >
> > I'm trying to create a hover for an image...I included the functions
> > in the second parameter of $html->image().
> >
> > Is there something I'm missing?
> >
> > I would appreciate any advice.
> >
> > Thanks,
> > ~S
> > >
> >
>
> >
>


-- 
Thanks & Regards,
Vijayk.
Co-founder (www.weboniselab.com)

"You Bring the Dreams, We'll Bring the Means"

--~--~-~--~~~---~--~~
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: Using Javascript link

2009-08-09 Thread brian

It could be a lot of things. Can you post your code?

On Sat, Aug 8, 2009 at 9:32 PM, Sarah wrote:
>
> I'm having trouble getting my javascript to work.
>
> The api recommends using link and putting the scripts and contents
> into the webroot/js folder.  I tried this, but it isn't working.
>
> I'm trying to create a hover for an image...I included the functions
> in the second parameter of $html->image().
>
> Is there something I'm missing?
>
> I would appreciate any advice.
>
> Thanks,
> ~S
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---