Get help. Give help. A Web Design and Development Community.

Template engine and include

  • # April 3, 2013 at 9:52 pm

    I want to separate the presentation from the business logic, and i wrote a class.

    Template engine working like any other.





    $content_i_want_to_add = ‘yeah, this is my page content’;
    $content->set(‘content’, $content_i_want_to_add);

    This part is working great. Problem is when i need to include file on index.php with some data that can be turned on or off. Example:


    $content->set(‘content’, $content_i_want_to_add);
    if ($show_time == “on”) {


    } // how to “set” this?


    if ($show_time == “on”) {

    echo ‘

    ‘ . date(“d.m.Y.”) . ‘
    ‘ . date(“H:i”) . ‘



    This is just example, i have a lot of other, more complex, situations when i need to include a file (echo data that i include). Some files that I include have more then 400 lines of code…

    How to solve this?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We have a pretty good* newsletter.