Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6824135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:51:57+00:00 2026-05-26T21:51:57+00:00

I can’t come up with a solution to the following problem. Let’s say i

  • 0

I can’t come up with a solution to the following problem. Let’s say i have a library (.php) file that I put inside codeigniter’s library folder but that library has some javascript associated with it: I have the library “grid.php” and it has “grid.js” that comes with it. And when I load the library “grid” the

<script src="base_url(). 'application/libraries/grid/grid.js'></script>

is echoed in the page where I have used the grid. The problem is that the “.js” file gets forbidden access and therefore cannot be used.
I dont want to put my grid in the root level of codeigniter because I won’t be able to load it with $this->load->library(‘grid’) and I dont want move my js files manually to the root and then include them manually every time I use the grid I just want to copy and paste the grid folder to every project I need and when I use it it would include the js link automatically. Help me please 🙂

I saw the “Deny all” .htaccess file that resides in application and system folders but i don’t want to remove that either (if it’s causing the problem) 😀

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:51:58+00:00Added an answer on May 26, 2026 at 9:51 pm

    I saw the “Deny all” .htaccess file that resides in application and system folders but i don’t want to remove that either (if it’s causing the problem) 😀

    It’s good that you don’t want to remove that, it’s helping to keep your application (and sensitive info like DB passwords) inaccessible over http. However, that’s exactly the reason you can’t access javascript files this way.

    You have to bite the bullet. Move the js files into an accessible directory.

    I don’t see any reason why you have to write the tags out manually if you are using PHP – you might want to look into writing or adopting some kind of template/asset library that other libraries can “hook into” and dynamically add js/css to the template.

    Quick example:

    class Template {
    
        private $js;
    
        function add_js($src)
        {
            $this->js[] = $src;
        }
    
        function get_js()
        {
            $out = '';
            foreach ($this->js as $src)
            {
                $out .= '<script src="'.$src.'"></script>';
            }
            return $out;
        }
    
    }
    
    • Make sure Grid can access the CI instance. The most common method: assign a reference to a class property of Grid in the __construct().

      $this->CI =& get_instance();
      
    • Add the script from your Grid library:

      $this->CI->template->add_js('/path/to/grid.js')
      
    • In your HTML template, call $this->template->get_js() to print the tags

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone recommend a good library for generating an audio file, such as mp3,
Can somebody point me to a resource that explains how to go about having
Can a LINQ enabled app run on a machine that only has the .NET
I have a jquery bug and I've been looking for hours now, I can't
I have just tried to save a simple *.rtf file with some websites and
Can anyone give me an example of how to return the following json simply
Can PHP PDO extension bind nested objects automatically ? I mean using foreign key
Can anybody tell what is the best(easy) way to sort the following string 'index'
Can someone guide me on a possible solution? I don't want to use /bin/cp
Can't figure out how to do this in a pretty way : I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.