TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
Views structrure / folder hierarchy
  • Hi, I have a general question about how you manage your views folder in KO3. What I am looking to understand is what is the best apporach to organize your views. I am considering that I will basic containers view that will hold additional views in them.
    Something like that
    main_container.php (holds html, head, body)
    includes
    -->header.php (holds top menu)
    -->content.php(holds inner content)
    includes
    -->left_column.php
    -->right_column.php

    and so on.

    But how to keep them in the views folder. What kind of hierarchy will you suggest? Maybe I should organize them regarding the controllers that use them. But what about some controllers use the same view?

    Any ideas will be appreciated.
  • views/
    common/
    header.php
    content.php
    left_column.php
    right_column.php
    project1/
    content.php
    left_column.php
    right_column.php
  • Well I was thinking about something like that

    view/
    /block
    block1.php
    block2.php
    /layout
    layout1.php
    layout2.php
    column1.php
    column2.php
    /controller_name1
    ...
    /controller_name2
    ...

    How to separete different pages/parts of the application in a nice and correct manner?
  • You might want to investigate templates before finalising your design.
  • I use:

    /views
    /template
    main.php
    /dashboard
    v_index.php
    /profile_page
    v_index.php
    v_edit.php

    /template/main.php holds both header and footer
    the rest are content views

    from main.php I will require an $content
    in the controller I put $content = View::factory('dashboard/v_index');

    oh, and if I want to separate logic even more I create a folder like /widgets where I store the respective views

  • views/
    chunks/
    controllers/
    admin/
    rightbar.php
    leftbar.php
    user/
    rightbar.php
    leftbar.php
    reports/
    rightbar.php
    leftbar.php
    models/
    campaign/
    ajax/
    form.php
    list.php
    edit.php
    close.php
    user/
    ajax/
    form.php
    list.php
    edit.php
    profile.php
    errors/
    404.php
    500.php
    error.php
    noscript.php
    templates/
    default.php
    reports.php
    into.php
    splash.php
  • Off topic : How do you put code segment in the forum posts with tab space as "jeremy.f76" did in previous post?
  • like this?
    just wrap it in < code > < / code > tags (without the spaces)