template

修改首頁的template

你可以使用一個和其他頁面完全不同的首頁, 只要你能應用 template suggestion.

打開你的theme_developer module, 指一下首頁,
你便會發現frontpage 是有一個特別的suggestion: page-front.tpl.php

你只要在你的theme folder 內建立/複製一個page-front.tpl.php,
然後你便可以開始加特別的class 到body,
或者使用完全不同的region (front-left, front-mid-left, front-mid-right, front-right)
把首頁變作4欄以應付首頁大量資料的需求

p.s. 記得清空你的cache 以使用新增的page-front.tpl.php
p.p.s 你當然也可以使用panels 之類的模組完成相同的效果

原文: http://drupal.org/node/317461

Theming search form, 搜尋框的模版

因為 drupal 原本內建的search form 搜尋框實在太單調的關係,
修改一下它的外觀, 模版...

當然, 先打開 search module(今天的主角), devel module, theme developer(開發用主角)
將search block 放到 sidebar,
用 theme developer 指一下,
便知道 search module 已經內建了搜尋框的 template 以供使用, 修改
search-block-form.tpl.php 是在 block 之內的 template
search-theme-form.tpl.php 便是其他情況下使用的 template
可以直接到 [base_path]/module/search 之內
複製所需的template 到你的 theme 之內
清空你的 cache 緩存, 你的theme 便會自動使用這個你新增的 template 檔了

其實一個搜尋框只有三種元素 (element) >Read more

  1. 輸入框 (textfield)
  2. 確定按鈕 (button)
  3. 隱藏參數 (hidden variable)