I would like to know if it's possible to override on runtime the cachePath defined inside this method:
http://li3.me/docs/lithium/template/view/Compiler::template()
I am trying to use lithium as a multitenant application and I am trying to seperate everything between tenants including compiled templates.
There are lots of ways to do it, depending on your implementation. One way is to set the compiler.path parameter of your html (or other content types) handler in using Media::type function during bootstrap.
For example:
Media::type('html', null, array(
'cast' => false,
'view' => 'lithium\template\View',
'paths' => array(
'template' => '{:library}/views/{:controller}/{:template}.{:type}.php',
'layout' => '{:library}/views/layouts/{:layout}.{:type}.php',
'element' => '{:library}/views/elements/{:template}.{:type}.php'
),
'compiler' => array(
'path' => '/path/to/your/cache/folder'
)
));
But judging by your requirement, it looks like you're better off extending \lithium\template\view\Compiler class and override the template function.
You can do this by setting the class name of the compiler using the same Media::type function
Media::type('html', null, array(
'cast' => false,
'view' => 'lithium\template\View',
'paths' => array(
'template' => '{:library}/views/{:controller}/{:template}.{:type}.php',
'layout' => '{:library}/views/layouts/{:layout}.{:type}.php',
'element' => '{:library}/views/elements/{:template}.{:type}.php'
),
'classes' => array(
'compiler' => '\namespace\class\name'
)
));