Answer the question
In order to leave comments, you need to log in
Yii and smarty-renderer
I am developing a SaaS application in Yii divided into frontend and backend and a few more parts. The task is to use Smarty on the frontend, but the difficulty is this:
The frontend's task is to “give out” different themes depending on the HTTP HOST. Each such site is a separate folder, which is located in webroot.themes.http_host
On the frontend there is actually only one controller, in which there is only one action that renders different views depending on the HTTP HOST and GET parameters
I need using smarty- renderer to render these same views, but the structure needs to be like this:
The webroot.themes.http_host folder should contain the "index.tpl" file and the "pages" folder, in which it can find an unlimited number of files.
The problem is that with such a structure, I have to write the full path for view files in the form of aliases, including in *.tpl files when using {include file="..."}
Question: how to set the default path and where do exactly that?
Now in the controller action I have to write the view path:
$this->render('webroot.themes.'.Y::param('domain').'.index', array('page' => $page));
Answer the question
In order to leave comments, you need to log in
He asked, he answered.
Yii::app()->viewRenderer->getSmarty()->setTemplateDir(Y::alias('webroot.themes.'.Y::param('domain')));
$this->render('webroot.themes.'.Y::param('domain').'.index', array('page' => $page));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question