只是一點點啓示 您可以通過使用觀察者添加這些佈局的xml, 比方說,你想添加的佈局XML生成
我們可以使用事件controller_action_layout_generate_xml_before
這裏的XML之前的示例代碼(在3210)
<frontend>
<events>
<controller_action_layout_generate_xml_before>
<observers>
<add_new_layout>
<class>test/observer</class>
<method>addNewLayout</method>
</add_new_layout>
</observers>
</controller_action_layout_generate_xml_before>
</events>
</frontend>
這裏的Observer.php
public function addNewLayout($observer){
$layout = $observer->getEvent()->getLayout();
$update = $layout->getUpdate();
//$action = $observer->getEvent()->getAction();
//$fullActionName = $action->getFullActionName();
//in case you're going to add some conditional (apply these new layout xml on these action or other things, you can modify it by yourself)
//here is the pieces of layout xml you're going to load (you get it from database)
$xml = "<reference name='root'><remove name='footer'></remove></reference>";
$update->addUpdate($xml);
return;
}