Welcome Guest, Not a member yet? Register   Sign In
Integrating CI and JQuery
#1

[eluser]peterbz[/eluser]
I was just wondering where I would place the JQuery files in CI.
#2

[eluser]mmarcus44[/eluser]
jQuery is javascript, which is a client side/public file. The best thing to do is put this in the same folder or subfolder as your images and css.

Anywhere outside the application directory is good.

If you have disabled the index file from appearing with apache rewrite, make sure to update your .htaccess file too.

The reason you should update this file is if you decide to create a new directory for js files only.

BTW jQuery rocks!
#3

[eluser]Phil Sturgeon[/eluser]
Take a look at my asset helper for some logical structuring and a handy way to call files.

Code:
- public_html
-- assets
--- img
--- css
--- js
---- modules
----- blog
------- img
------- css
------- js
----- etc...

It's not really integration unless you go nuts and start writing your JS in your PHP files.
#4

[eluser]peterbz[/eluser]
[quote author="mmarcus44" date="1229604380"]
If you have disabled the index file from appearing with apache rewrite, make sure to update your .htaccess file too.

The reason you should update this file is if you decide to create a new directory for js files only.[/quote]

Why would I need to update the htaccess file to access the js directory if it's located outside the application directory?
#5

[eluser]missionsix[/eluser]
Because some, or most, people who use CI like to removed the index.php/ from the URL. The .htaccess redirect allows this to happen. Depending on the type of redirect used, you might need to add an exception for the javascript folder so javascript locations do not get routed through index.php.


I hope this makes sense.




Theme © iAndrew 2016 - Forum software by © MyBB