public function getDynamicBlock($p_block_prefix = '', $p_block_id = '', $p_arr_xml_block = array()) {

10     if(empty($p_block_prefix))
11         $m_block_prefix = 'header_content_';
12     else
13         $m_block_prefix = $p_block_prefix;
14     if(empty($p_block_id))
15         $m_block_id = Mage::registry('current_category')->getId();
16     else
17         $m_block_id = $p_block_id;
18  
19     $m_block_path = $m_block_prefix.$m_block_id;
20     $m_static_block = Mage::getModel('cms/block')->load(trim($m_block_path));
21  
22     if(is_null($m_static_block->getId())) {
23         if(count($p_arr_xml_block) > 0) {
24             $m_xml_template = $p_arr_xml_block['template'];
25             $m_xml_singleton = $p_arr_xml_block['singleton'];
26             $m_xml_name = $p_arr_xml_block['name'];
27             $m_xml_block = Mage::app()->getLayout()->getBlockSingleton($m_xml_singleton)->setName($m_xml_name)->setTemplate($m_xml_template)->toHtml();
28  
29             return $m_xml_block;
30         }
31     }
32     else
33         return $m_static_block->getContent();
34 }