![]() |
How to inlucde external javascipt libraries - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to inlucde external javascipt libraries (/showthread.php?tid=59072) |
How to inlucde external javascipt libraries - El Forum - 08-20-2013 [eluser]Unknown[/eluser] I have a web page which needs to include external javascript libraries. I have downloaded them and include in the php->libraries folder. My application is hosted in openshift cloud. I want to include those javascript files in my php file. I have used this code script src="../../libraries/dhtmlxCalendar/dhtmlxCalendar/codebase/dhtmlxcalendar.js"> But it is not working then I tried script type="text/javascript" src="<?php echo base_url();?>js/jquery.js" > The base url gives me the url but it is also not working. What is the correct way for this ? I am a beginner for codeigniter. Could you help me How to inlucde external javascipt libraries - El Forum - 08-20-2013 [eluser]ricmen[/eluser] did you have an .htaccess in which you are re writing the index.php? if so then you have to add the js extension in RewriteCond like this # Allow these directories and files to be displayed directly: RewriteCond $1 ^(index\.php|txt|js|robots\.txt|images|css|opensearch\.xml|favicon\.ico|assets|forums) How to inlucde external javascipt libraries - El Forum - 08-20-2013 [eluser]Unknown[/eluser] My .htaccess files is like this now RewriteEngine on RewriteCond $1 ^(index\.php|txt|js|robots\.txt|images|css|opensearch\.xml|favicon\.ico|assets|forums) RewriteRule ^(.*)$ /index.php/$1 [L] Now can I use the script type=“text/javascript” src=”<?php echo base_url();?>js/jquery.js” line to include the javascripts ? How to inlucde external javascipt libraries - El Forum - 08-20-2013 [eluser]ricmen[/eluser] well if works tell me please to know my .htaccess file is this <IfModule mod_rewrite.c> # Turn on URL rewriting RewriteEngine On # If your website begins from a folder e.g localhost/my_project then # you have to change it to: RewriteBase /my_project/ # If your site begins from the root e.g. example.local/ then # let it as it is RewriteBase /MYAPP/ # Protect application and system files from being viewed when the index.php is missing RewriteCond $1 ^(application|system|private|logs) # Rewrite to index.php/access_denied/URL RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L] # Allow these directories and files to be displayed directly: RewriteCond $1 ^(index\.php|txt|js|robots\.txt|images|css|opensearch\.xml|favicon\.ico|assets|forums) # No rewriting RewriteRule ^(.*)$ - [PT,L] # Rewrite to index.php/URL RewriteRule ^(.*)$ index.php/$1 [PT,L] </IfModule> How to inlucde external javascipt libraries - El Forum - 08-20-2013 [eluser]CroNiX[/eluser] Hard to tell with your relative (not good) path, but if that is within the /application or /system dir that's why it doesn't work...those are not publicly accessible for security reasons. Just like you can't go to http://yoursite.com/application/controllers/some_controller.php How to inlucde external javascipt libraries - El Forum - 08-23-2013 [eluser]InsiteFX[/eluser] All your assets files should be in a directory called assets in the root where index.php is. Code: application |