TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Two direcotories for modules
  • Hi there!

    I use separated directory for my Kohana (modules and system) = I will have more projects (totally different websites) and one shared Kohana directory.

    In my shared Kohana directory I would like to create the CMS. There would be a parent class (parent module) of all my own modules for CMS:

    class Controller_Cmscore extends Controller_Template

    And all my common modules would have this module as a parent:

    class Controller_Faq extends Controller_Cmscore class Controller_Pages extends Controller_Cmscore class Controller_News extends Controller_Cmscore

    All these modules would be in my shared directory together with system directory. Till this point I have no problem :-)

    But.. some projects are specific and need specific modules.. and I don't want to have specific modules in my shared directory - those modules I would like to have in my frontend application directory. So I need to have two different directories for my modules and also cascading system for those two directories.

    Is there some solution? Thanks.

  • I use separated directory for my Kohana (modules and system)

    In my setup, I have 4 different directories. 1. Kohana system, 2. the official modules, 3. third-party modules and 4. my modules. You just need to hack around the index.php a little, so that you have new paths like MYPATH.

    I did not version-ed things the way the docs recommended. However, you may want to do that. Upgrading all applications at once is painful.

    and I don't want to have specific modules in my shared directory

    And why not? if some specific module is shared between 2 apps, it's no more specific. Try to make the modules as generic as possible.

    You can always configure a module: you can do that with config files, or by instantiating a class with specific params. You can also override the full implementation of a class through the cascading filesystem (make empty classes in your module and the real class implementation goes deeper).

    So I need to have two different directories for my modules

    And sometimes more than two, like this

    -  mymodule
      -  backend
        -  classes
      -  frontend
        -  classes
      -  core
        -  classes (you might want to put models that are shared with backend and frontend here)
    

    However, to enable the module in bootstrap, you need to point to the inner directory

    'mymodule-backend'  => MYPATH.'mymodule'.DIRECTORY_SEPARATOR.'backend',
    'mymodule-core' => MYPATH.'mymodule'.DIRECTORY_SEPARATOR.'core',
    

    Happy coding!

  • @enov not 2 modules - 2 application

  • Hey @WinterSilence,

    @enov not 2 modules - 2 application

    ::puzzled

    I'm reading the OP and reading your comment again, and I don't understand.

    So I need to have two different directories for my modules

    Perhaps the OP means 2 different paths defined in index.php? But that's also covered in my post.

  • Thank you. I choosed to add a new directory in my index.php and bootstrap.php.

  • @enov new members don't always true asked questions

  • @WinterSilence, he's been around since 2008.

    Perhaps he is new to v.3? What did he do meanwhile? Did he use another framework? What framework did he use? Why did he come back? Am I gossipin' again? lol...

    As a side note, could we enable emoticons in this forum? Just to have more fun?

    love

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion