This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

plugin layout

Ask help about existing plugins, or find advice about the way to build up your own.

plugin layout

by dearaujoj » Thu Dec 08, 2011 6:36 pm

Hi folks,
I have developed a plugin that has two modules one for backend and the other one frontend and I have created a layout for each of them.
In the view.yml of each module I have specified the layout to use for the views as follow:
Code: Select all
all:
  layout:    my_module_layout


but when I run the backend of my module I have the following error:
sfRenderException
The decorator template "admin_layout.php" does not exist or is unreadable in "".


Although I was expecting the application to find the layout under my plugin/modules/mymodule/templates folder but it seems that the decorator doesn't have it.

Any help will be appreciate.

Thanks

José
dearaujoj
Junior Member
 
Posts: 20
Joined: Fri Jun 10, 2011 7:19 pm

Re: plugin layout

by dearaujoj » Sun Dec 11, 2011 8:02 pm

For the ones who are interested, here is a solution that worked for me:
Code: Select all
$template = $this->getContext()->getConfiguration()->getTemplateDir('MODULE', 'LAYOUT_FILE.php');
$this->setLayout($template . '/LAYOUT_FILE');


Using the previous code in an action let you load any layout without having to copy it in the global template folder.

Thank you to Van de Voorde Toni for his post http://www.devexp.eu/2011/10/28/how-to-use-a-symfony-1-layout-from-a-different-directory/

cheers
dearaujoj
Junior Member
 
Posts: 20
Joined: Fri Jun 10, 2011 7:19 pm

Re: plugin layout

by glassyflower » Wed Apr 25, 2012 4:55 am

dearaujoj wrote:For the ones who are interested, here is a solution that worked for me:
Code: Select all
$template = $this->getContext()->getConfiguration()->getTemplateDir('MODULE', 'LAYOUT_FILE.php');
$this->setLayout($template . '/LAYOUT_FILE');


Using the previous code in an action let you load any layout without having to copy it in the global template folder.

Thank you to Van de Voorde Toni for his post http://www.devexp.eu/2011/10/28/how-to-use-a-symfony-1-layout-from-a-different-directory/

cheers

thank for share
glassyflower
Junior Member
 
Posts: 1
Joined: Mon Apr 23, 2012 5:04 am