Search code examples
phpidiormraintpl

RainTPL Template output incorrect


I am using RainTPL, Idiorm and Gluephp for a simple website driven by a sqlite database.

When the front page is loaded everything is fine. http://home.techtic.info

When the other page is looaded i get the output from the front page and the output from the other page that is loaded by RainTPL. http://home.techtic.info/admin

Question : How can i prevent the data from loading when the second url is loaded?

This is the code:

RainTPL::configure('tpl_dir', 'view/');
RainTPL::configure('cache_dir', 'app/cache/');
RainTPL::configure('base_url', 'http://' . $_SERVER['SERVER_NAME'] . '/');
RainTPL::configure('tpl_ext', 'php');
RainTPL::configure('php_enabled', true);

ORM::configure('sqlite:app/database');

$urls = array(
    '/' => 'index',
    '/admin' => 'admin'
);

class index {

    function GET() {
        $content = ORM::for_table('product')->find_array();

        $index = new RainTpl();
        $index->assign('content', $content);
        $index->draw('main');
    }

}

class admin {

    function GET() {
        $admin = new RainTpl();
        $admin->draw('admin/admin');
    }

}

Solution

  • Been trying for 4 hours now. RainTPL does not like subdirectories. If you have the same problem. do not put the template files in subdirectories.