Zand Php Cake Php

Posted by : awh
Implement jQuery UI into CakePHP application
I'm working on something during my free time and at the same time
trying to learn. I read around and know that it is possible to
implement jQuery UI into a CakePHP application and that it was
supposed to be easy.

Been mingling around for a while and still have no idea. Would
appreciate if anyone could guide me on how to implement this. I'm
using:-

- jQuery UI 1.7.2 or I could move to jQuery UI 1.6 if needed.
- CakePHP 1.2.3.8166

Now, when i downloaded the zipped jQuery UI file, it includes

- css dir (have ui - darkness dir here and an img folder inside it
along with a jquery.css file)
- development dir (a shit load of directories and files in here)
- js dir (the jquery.js file seems to be in here)
- index.html

I have my jquery stuff set up like:

webroot
|_ js
   |_ jquery
        |_ jquery.js
        |_ ui
            |_ core.js
            |_ accordion.js

Then in my view I do:

<?php echo $javascript->link(array("jquery/jquery.js","jquery/ui/
core.js","jquery/ui/accordion.js"),false); ?>

<div id = "accordion">

[bad html removed] Put your accordion stuff here -->

</div>

<script type = "text/javascript">

$(function () {

$("#accordion").accordion({

// options go here

});

});

</script>

but it didnt seem to work out for me.

First thing is, where do i put all the files and folders in my cake
dir?

Second thing is, besides the view, do i need to load any components,
helpers or the likes into my controller to be able to use this UI?
would appreciate if someone could include the code for the view and
contoller as im very much clueless.

my cakephp app is just a fresh install with the "blog tutorial" setup
on it only. trying to get this setup before moving onto other stuff.
hope someone can help me out with this coz i cant design and code even
if my life depended on it.

 
 
Posted by : brian
Re : Implement jQuery UI into CakePHP application
You should remove the ".js" extension:



<?php echo $javascript->link(array("
jquery/jquery","jquery/ui/core","jquery/ui/accordion"),false);

?>



There's no need for a component or anything special in the view.
 
 
Posted by : JamesF
Re : Implement jQuery UI into CakePHP application
i take a bit of issue with your statements "hope someone can help me

out with this coz i cant design and code even

if my life depended on it. "  i personally don't understand what you

mean by it doesn't work. you should really dig a bit deeper and

troubleshoot your own code.



ex. 'I expected the accordion to work like this, but it does not."



step 1) is jquery accordian module loading correctly? is jquery

loaded? examine your source code

step 2) are there javascript errors? what do they tell me? maybe there

is a typo i missed in my $(document) function

step 3) is my html set up correctly with the right hooks for jquery to

select?



and finally a word of advice with jquery ui....do you really need to

use it?...including css and modules/effects you are adding an avg

300-500k to your webpage. you could just get a smaller accordion

plugin and a minified jquery build and call it a day.



i don't mean to be harsh but most of the folks around here really

appreciate when someone takes the time to research
 
 
If you have the better reply, then send it to us. We will display your reply after the approval.
Name : 
Email Id :   
Reply :