user1559599
user1559599

Reputation: 545

HMVC in Codeigniter - assets folder

I am developing an app in Codeigniter with HMVC. Right now I have this folder structure:

-Aplication
-Assets
--Module1
---js
---css
--Module2
-System 

But i want migrate each asstets module into module folder

-Application
--Modules
---Module1
----assets
----controllers
----views
----models

I'm trying everything but without success. I can't access to assets folder placed inside module.

Any idea how can I get access to that folder?

Upvotes: 2

Views: 1558

Answers (2)

Deepak Panwar
Deepak Panwar

Reputation: 179

I added an array to the Module class to store the assets and two functions to store/retrieve the items. Here is the source (updated Modules.php)

        #Reigister your assets
        public static function register_asset( $asset )
        {
           if( in_array($asset,self::$assets) === FALSE )
           {
              self::$assets[] = $asset;
           }
        }

       public static function assets()
       {
             return self::$assets;
       }

and now you can register your assets like this inside your module

Modules::register_asset('myslider.js');

You can retrieve all your assets using

Modules:assets();

Which will return an array of assets that can be processed depending up on the situation.

Upvotes: 1

santosh
santosh

Reputation: 787

<a href="<?php echo base_url() ?>application/modules/modules1/assets/css/style.css">Link</a>

Upvotes: 1

Related Questions