Welcome Guest, Not a member yet? Register   Sign In
Javascript with Code Igniter
#1

[eluser]Alfredo Palhares[/eluser]
Hello, I am first time using Code Igniter and I am felling very whit it.

But i having problems no using externals javascript files in my views

When i make:
Code:
<[script tag] type="text/javascript" charset="utf-8" src="form_utils.js"></[script tag]>
Note: The file is the same directory as in the view file.
Note 2: I changed the script tag because the forum remove my code if i don't do that.

How do use it?
Is there any documentation that i can read about that?
I searched the hole user manual i didn't found anything.

Thanks already,
Alfredo Palhares
#2

[eluser]Xarren[/eluser]
I think what you're after is
Code:
src="&lt;?php echo base_url(); ?&gt;application folder/view folder/file name.js"
.
#3

[eluser]pickupman[/eluser]
File paths are relative to the index.php file since that's what runs the show. You may find it helpful adding a leading slash to the beginning of your source. After you get your feet wet with CI, you may want to check out Carabiner. A link is provided in my signature, that will minify/combine your css/js files. You can add files dynamically in your controller/views, or do it statically.




Theme © iAndrew 2016 - Forum software by © MyBB