我感覺我必須真的很接近,但是從正確渲染出我的第一個Drupal模塊的一點點(儘管當然下一步是通過ajax提交和處理表單,猜測我不是很完美在樹林裏)如何讓我的模塊的模板文件在Drupal 7中呈現?
不管怎樣,從「Pro Drupal Development 7」開始,在堆棧上閱讀和詢問一些問題,我已經到了設置Drupal模塊的地步。
\sites\all\modules\custom\mymodule
---- mymodule.info
---- mymodule.css
---- mymodule.js
---- mymodule.tpl
---- mymodule.module
所有的要求似乎能正常運行,以獲得模塊在我的名單塊的CSS,JS &在頁面上可見,如果我選擇查看源。
爲了測試目的,我的TPL文件只包含以下內容。
<h1> HERE </h1>
模塊文件(根據我的理解,這是我寫我的主題鉤子的地方)有以下(從我收集的)主要功能。
function mymodule_theme($existing, $type, $theme, $path){
return array(
'mymodule' => array(
'variables' => array('content' => "FOO"),
'file' => 'mymodule',
'path' => drupal_get_path('module', 'mymodule')
)
);
}
function mymodule_page(){
$content = "";
return theme('mymodule', $content);
}
我很確定我只是有一個小的,相對簡單的問題 - 但一直在我自己的一個小時內鑿去。有誰知道答案,我在這裏錯過了什麼?
謝謝!
這是不正確的。你不需要drupal_render塊的內容。 – chx
謝謝,我糾正了。 –