CodeIgniter HMVC Template Solution

Discussion in 'PHP' started by phpzone, May 11, 2015.

  1. #1
    Hello All,

    I'm interested in your opinion about this topic because. I am confuse about this
    I am working on a codeigniter project with HMVC module.

    I want to use template system so I can change template easily in future. and can more than one template for my application.

    I am doing it like

    There is template directory inside application/views/ where I am putting header and footer sidebar etc.
    the structure is like this
    application/views/
    default
    header.php
    footer.php
    left-sidebar.php
    right-sidebar.php​
    my-template1
    header.php
    footer.php
    left-sidebar.php
    right-sidebar.php​
    my-template2
    header.php
    footer.php
    left-sidebar.php
    right-sidebar.php
    ​
    Also I am managing my other views inside modules directory like this
    application/module/
    dashboard/views/
    /default
    welcome_view.php
    edit_view.php
    index_view.php​
    /my-template1
    welcome_view.php
    edit_view.php
    index_view.php​
    /my-template2
    welcome_view.php
    edit_view.php
    index_view.php​
    pages/views
    /default
    index_view.php
    edit_view.php​
    /my-template1
    index_view.php
    edit_view.php​
    /my-template2
    index_view.php
    edit_view.php
    ​
    And I create a library to render view.

    Now my question is this the right way of doing it or there is some other easy or less complex way of doing it.


    ​


    ​
     
    phpzone, May 11, 2015 IP