bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.6k forks source link

System Javascript library "external function" will not load local js files. And documentation missing information. +fix on forum #1322

Closed websam101 closed 9 years ago

websam101 commented 12 years ago

I know it's experimental and the guide is really not up to date on this section but it would be nice to fix this to be able to script a template engine without hacking the core with every CI installations or making another function to load anything and missing a lot of good features...

The details of the bug were already posted it in the forum on September 2011... http://codeigniter.com/forums/viewthread/200966/

My explanations are confusing but I don't know how to explain it another way. I have posted it for the 2.0.3 version of CI but it's not fixed on the current 2.1.0 The logic of the loader is wrong, it double load the name of the file instead of loading the needed file.

Some examples:

This will fail since it's asking the same function: <?php echo $this->javascript->external('jquery'); ?> <?php echo $this->javascript->external('jquery.js'); ?> <?php echo $this->jquery->script('jquery'); ?> <?php echo $this->jquery->script('jquery.js'); ?>

The results will be: <... .../jqueryjquery"> <... .../jquery.jsjquery.js"> <... .../jqueryjquery"> <... .../jquery.jsjquery.js">

The config folder is ignored on this function as well: $config['javascript_location'] = 'http://localhost/assets/js/';


CI user guide missing information: (Javascript Class)

Missing information on initializing the $data in the controller... (Loading with: $this->javascript->external() + $this->jquery->script()).

So less experimented users will only have errors when fallowing the user guide and inserting this in the layout without initializing before: <?php echo $library_src;?> <?php echo $script_head;?>

narfbg commented 9 years ago

Nobody has interest in supporting the JS library, and on top of that it's both experimental and already deprecated ... If anybody wants to fix this - submit a pull request please. Closing now.