Try addScript() -
http://api.cakephp.org/1.2/class_view.html#42c9e03d9fa609bd09d9530d9ee8266b
You can use it like that:
<?php $this->addScript($javascript->link(array('jquery','ui.tabs'))); ?
>
<?php $this->addScript($javascript->codeBlock('$(function() { $
("#album-data > ul").tabs(); });')); ?>
<?php $this->addScript($html->css(array('ui.tabs'))); ?>
T+
On Apr 22, 6:15 am, . <[EMAIL PROTECTED]> wrote:
> in cake 1,2 How do you add a javascript function in just one of my views? I
> don't want to put it in the layout because i don't need the JS in all of the
> pages.
>
> There are 2 cases:
> 1. I want to add echo $javascript->link(array(js_file)); to one of my view
> ctp file
> 2. I want to add a <body onload="JS function"> to on of my pages
>
> How would I achieve the above without creating a new layout ctp file?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---