4
我試圖實現模式和模板建議,但它不起作用。
這裏是hook_theme()
與我的模式實現:使用模板模板建議不起作用hook_theme()
$theme['nm_home_page_zone'] = array(
'pattern' => 'nm_home_page_zone__',
'arguments' => array('nodes_content' => array(), 'nodes' => array()),
'template' => 'zone-contenu',
),
我呼籲theme()
用下面的代碼:
$output .= theme(array('nm_home_page_zone__'.$rowZone->model.'_'.$rowZone->weight, 'nm_home_page_zone__'.$rowZone->model, 'nm_home_page_zone'), array(), array());
我得到了2個模板文件(區,contenu.tpl.php和區域-contenu - one.tpl.php)在我的主題和我的模塊(只是肯定)。
模式和模板建議應使用zone-contenu-one.tpl.php在我的情況下,但它不起作用。
我在這裏錯過了什麼?
根據http://drupal.stackexchange.com/questions/48302/use-of-pattern-in-hook-theme該模式並未實際使用。因此,您應該將您的模板(前綴)命名爲主題鉤子。 – Neograph734