0

I am new in CI - and the framework is awesome.

These are the best answers I can get:
- CodeIgniter: How do I include a .js file in view?
- Codeigniter: How to include javascript files

I am trying to include js/css files but: My CI folder including application and system are not installed on the http(/var/www/)[for default installation] folder, I placed somewhere else. So i assume their installations above are in http default folder, I have :

http:
/var/www
CI:
/opt/codeigniter

+aplication
+system

Thank you so much in advance

2
  • 1
    base_url() will return your project path. Then you can use ../ to include file with the correct path. Commented Jan 21, 2014 at 16:20
  • thanks @kumar_v i actually didnt get it so clearly, Im sorry, but I will try it.. am still puzzling it... is it base_url /../js/jquery.js or ../ base_url /js/jquery.js - thank you for the reply Commented Jan 21, 2014 at 17:43

1 Answer 1

0

Use this code

<script href="<?php base_url().'path/to/file' ?>" type="text/javascript"></script>

The javascript folder should be outside the application folder

app_folder

-application

--views

--controllers

-system

-css

-js

Hope this helps

Sign up to request clarification or add additional context in comments.

1 Comment

thank you @hubert I tried it and still no luck, I guess i will have to place my js/css files in my http folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.