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
  • Besides the opinion themes are css only, it is sometimes very useful to change a bit of HTML (eg. order of elements).

    Posted By: Olly (see here)Themes are simply modules with views, which means when i vall View::factory('template'), ill get the loaded theme's template file.

    Seeing themes as own modules has some disadvantages.

    • make sure they are placed before the "app" module
    • should one theme cascade from another (or is there only one theme module active)
    • how to separate them

    On the other side, theme modules are easier to plug in. (I still hold that modules aren't designed to be plugins, but it's another discussion)

    Themes are application specific. They present another "level" on top of views in my opinion. If you have two separate frontend/admin apps, themes belongs to their app folder.

    Serving an theme module, which extends the View->set_filename(), would offer such behavior.

    class View extends View_Core {

    * Sets the view filename.
    * @chainable
    * @param string view filename
    * @param string view file type
    * @return object
    public function set_filename($name, $type = NULL)
    if ( ! Kohana::config('themes.enabled'))
    parent::set_filename($name, $type);

    try {
    $path = 'themes/'.Kohana::config('themes.default');

    if ($type == NULL)
    // Load the filename and set the content type
    $this->kohana_filename = Kohana::find_file($path, $name, TRUE);
    $this->kohana_filetype = EXT;
    // Check if the filetype is allowed by the configuration
    if ( ! in_array($type, Kohana::config('view.allowed_filetypes')))
    throw new Kohana_Exception('core.invalid_filetype', $type);

    // Load the filename and set the content type
    $this->kohana_filename = Kohana::find_file($path, $name, TRUE, $type);
    $this->kohana_filetype = Kohana::config('mimes.'.$type);

    if ($this->kohana_filetype == NULL)
    // Use the specified type
    $this->kohana_filetype = $type;

    return $this;
    catch(Exception $e)
    parent::set_filename($name, $type);

    This has to be modified to search only the APPPATH.'themes' folder.

    What do you think? Are "module-level" themes enough?
  • Having cascading themes would be a nightmare, you'd have conflicting styles and files all over the place.
  • But themes as modules cascades. Or do you just add only one theme to the modules stack?
  • yea, only loads one theme at a time.
  • I don't see why themes should go above application... I feel you guys are complicating things again =P

    you have a CMS, if you want to add functionality to a CMS you write a plugin (or module or whatever you want to call it)
    application remains above everything (just like kohana intended it to be) so if you write something in application, it goes ABOVE the entire CMS because it is not part of the CMS

    I don't see the problem here... you are still technically running a kohana application, and the cms is a module (along with it's modules/plugins/themes)
    themes go above all CMS modules because it is a CMS theme... anything you write for the cms will be themed even though you aren't hacking the cascading filesystem to place themes above application
  • It doesnt involve any hacking at all, you just have a views and media folder in your theme directory. Nothing else is necessary. I thought this was the simplest way of doing it!
  • the hacking is the fact that you are putting a module above the application
  • why does it need to be above the application?
  • just quoting dyron

Howdy, Stranger!

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

In this Discussion