<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="http://joetsuihk.com/en/taxonomy/term/38/all" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>template</title>
    <link>http://joetsuihk.com/en/taxonomy/term/38/all</link>
    <description></description>
    <language>en</language>
     <atom:link href="http://joetsuihk.com/en/taxonomy/term/38/all/feed" rel="self" type="application/rss+xml" />
      <item>
    <title>Drupal 7 theming a node form</title>
    <link>http://joetsuihk.com/en/drupal_7_theming_a_node_form</link>
    <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;我慢慢發現 content type node form 是繼 exposed views form 之後最常要修改的 form&lt;br /&gt;
(我明明有寫過 alter exposed views form, 但找不到...)&lt;/p&gt;
&lt;p&gt;特定 content type 本身是沒有 theme function 的&lt;br /&gt;
先定義一個，順便定義使用一個 tpl 檔輸出&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-taxonomy-vocabulary-2 field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Free tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/free_tags/development&quot;&gt;Development&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/free_tags/theming&quot;&gt;theming&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/38&quot;&gt;template&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/free_tags/drupal7x&quot;&gt;Drupal 7.x&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/free_tags/node_form&quot;&gt;node form&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-add-this field-type-addthis field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a class=&quot;addthis_button &quot; addthis:title=&quot;Drupal 7 theming a node form - JOE Tsui&amp;#039;s Drupal life in Hong Kong (香港)&quot; addthis:url=&quot;http://joetsuihk.com/en/drupal_7_theming_a_node_form&quot;&gt;&lt;img src=&quot;http://s7.addthis.com/static/btn/sm-share-en.gif&quot; alt=&quot;Share page with AddThis&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Sat, 27 Oct 2012 15:01:18 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">330 at http://joetsuihk.com</guid>
  </item>
  <item>
    <title>改變 form 的 template</title>
    <link>http://joetsuihk.com/en/%E6%94%B9%E8%AE%8A_form_%E7%9A%84_template</link>
    <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;這次修改的是 views 的 exposed form&lt;br /&gt;
需要比較大的修改便想要使用 tpl 而不使用 template.php&lt;br /&gt;
舊文 &lt;a href=&quot;http://www.joetsuihk.com/form_templates&quot;&gt;form 也可以使用template (*.tpl.php)&lt;/a&gt;也有說明, 但已經不是 Drupal6.x 作法了&lt;/p&gt;
&lt;p&gt;以下更新為 Drupal6.x 的作法:&lt;br /&gt;
先自建一個模組, 使用 &lt;a href=&quot;http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_theme/6&quot;&gt;hook_theme&lt;/a&gt;&lt;br /&gt;
定義如下:&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-taxonomy-vocabulary-2 field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Free tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/38&quot;&gt;template&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/47&quot;&gt;form&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/free_tags/tpl&quot;&gt;tpl&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/free_tags/drupal6x&quot;&gt;Drupal 6.x&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/free_tags/hooktheme&quot;&gt;hook_theme()&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/free_tags/drupalrender&quot;&gt;drupal_render&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/free_tags/drupalplanet&quot;&gt;Drupal Planet&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-add-this field-type-addthis field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a class=&quot;addthis_button &quot; addthis:title=&quot;改變 form 的 template - JOE Tsui&amp;#039;s Drupal life in Hong Kong (香港)&quot; addthis:url=&quot;http://joetsuihk.com/en/%E6%94%B9%E8%AE%8A_form_%E7%9A%84_template&quot;&gt;&lt;img src=&quot;http://s7.addthis.com/static/btn/sm-share-en.gif&quot; alt=&quot;Share page with AddThis&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Mon, 21 Feb 2011 13:13:41 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">209 at http://joetsuihk.com</guid>
  </item>
  <item>
    <title>Drupal contact form use tpl.php 將聯絡表單的內容移到 tpl.php</title>
    <link>http://joetsuihk.com/en/drupal_contact_form_use_tplphp_%E5%B0%87%E8%81%AF%E7%B5%A1%E8%A1%A8%E5%96%AE%E7%9A%84%E5%85%A7%E5%AE%B9%E7%A7%BB%E5%88%B0_tplphp</link>
    <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;其實我做的是一個contact module 的擴充, cck 的 email field&lt;br /&gt;
它可以建立一個送到特定 email 欄的聯絡表單, 是建基於內建的聯絡表單的擴展&lt;br /&gt;
而我需要將它的 html 完全改變, contact form 的修改應該很類似&lt;/p&gt;
&lt;p&gt;步驟:&lt;br /&gt;
先在theme 注冊一個使用的 theme hook:&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-taxonomy-vocabulary-2 field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Free tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/38&quot;&gt;template&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/free_tags/tpl&quot;&gt;tpl&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/free_tags/templatesuggestion&quot;&gt;template suggestion&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/free_tags/contactform&quot;&gt;contact form&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/free_tags/hooktheme&quot;&gt;hook_theme()&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-add-this field-type-addthis field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a class=&quot;addthis_button &quot; addthis:title=&quot;Drupal contact form use tpl.php 將聯絡表單的內容移到 tpl.php - JOE Tsui&amp;#039;s Drupal life in Hong Kong (香港)&quot; addthis:url=&quot;http://joetsuihk.com/en/drupal_contact_form_use_tplphp_%E5%B0%87%E8%81%AF%E7%B5%A1%E8%A1%A8%E5%96%AE%E7%9A%84%E5%85%A7%E5%AE%B9%E7%A7%BB%E5%88%B0_tplphp&quot;&gt;&lt;img src=&quot;http://s7.addthis.com/static/btn/sm-share-en.gif&quot; alt=&quot;Share page with AddThis&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Mon, 18 Oct 2010 12:06:05 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">189 at http://joetsuihk.com</guid>
  </item>
  <item>
    <title>自定Views 欄位輸出 Views fields display</title>
    <link>http://joetsuihk.com/en/%E8%87%AA%E5%AE%9Aviews_%E6%AC%84%E4%BD%8D%E8%BC%B8%E5%87%BA_views_fields_display</link>
    <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;開發多了以後, 慢慢發展了一個自己比較喜歡的 views templating 方式, 分享一下&lt;/p&gt;
&lt;p&gt;1. Row style&lt;br /&gt;
絕大部份 &quot;Row style&quot; 都會使用 &quot;fields&quot;,&lt;br /&gt;
是為了靈活性, 可以在 &quot;Fields&quot; 取需要的欄位&lt;br /&gt;
相反 &quot;Row style&quot; &quot;node&quot; 只可以選擇 &quot;full node&quot; 或者 &quot;teaser&quot;&lt;br /&gt;
而且它的輸出就會使用 node.tpl.php&lt;br /&gt;
不方便, 我習慣自己建立 &quot;frontpage&quot; 資料夾專門用作放置該 views 的 template 的&lt;/p&gt;
&lt;p&gt;2. *.tpl.php 儲存結構&lt;br /&gt;
續上, 一個 views 在該 theme 之內都有一個資料夾&lt;br /&gt;
甚至是一個 display 一個, 例如 views &quot;frontpage&quot;:&lt;br /&gt;
--theme_joe (資料夾)&lt;br /&gt;
----frontpage (資料夾)&lt;br /&gt;
------views-view-fields--frontpage.tpl.php&lt;br /&gt;
----taxonomy (資料夾)&lt;br /&gt;
------views-view-fields--taxonomy.tpl.php&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-taxonomy-vocabulary-2 field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Free tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/free_tags/theming&quot;&gt;theming&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/33&quot;&gt;views&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/38&quot;&gt;template&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/free_tags/display&quot;&gt;display&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-add-this field-type-addthis field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a class=&quot;addthis_button &quot; addthis:title=&quot;自定Views 欄位輸出 Views fields display - JOE Tsui&amp;#039;s Drupal life in Hong Kong (香港)&quot; addthis:url=&quot;http://joetsuihk.com/en/%E8%87%AA%E5%AE%9Aviews_%E6%AC%84%E4%BD%8D%E8%BC%B8%E5%87%BA_views_fields_display&quot;&gt;&lt;img src=&quot;http://s7.addthis.com/static/btn/sm-share-en.gif&quot; alt=&quot;Share page with AddThis&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Mon, 30 Aug 2010 10:05:00 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">180 at http://joetsuihk.com</guid>
  </item>
  <item>
    <title>進階 views 模版(一): 簡介, 設定, tpl 檔 Complex views templating, part 1, intro, config, tpl</title>
    <link>http://joetsuihk.com/en/%E9%80%B2%E9%9A%8E_views_%E6%A8%A1%E7%89%88%E4%B8%80_%E7%B0%A1%E4%BB%8B_%E8%A8%AD%E5%AE%9A_tpl_%E6%AA%94_complex_views_templating_part_1_intro_config_tpl</link>
    <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;views 的 theming/templating 是Drupal theming 的高級班了&lt;br /&gt;
之前一直沒有信心將這個部份的教做好, 但這次都要挑戰一下難度, 唯有試試用多一點圖片展示了&lt;/p&gt;
&lt;p&gt;首先, 我們常用的theme developer 是不能夠幫我們查出 tpl 的檔名的 (但仍可以看到可用的 vars)&lt;br /&gt;
因為 views 的 templating 機制雖和 Drupal core 的極相似, 但卻是views 自己定義的&lt;br /&gt;
主要是為了應付更複雜, 更多變的情況&lt;br /&gt;
但也不需要擔心, 概念上, 操作上都和我們一向做的非常相似&lt;/p&gt;
&lt;p&gt;既然theme developer 不適用, views 有自己的 tpl suggestion: Basic settings 內的 Theme: information(下圖1)&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://www.joetsuihk.com/files/views-theming1_0.png&quot; /&gt;&lt;/p&gt;
&lt;p&gt;上圖二便是 tpl suggestions, 而粗體則是現正在使用的 tpl 檔&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-taxonomy-vocabulary-2 field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Free tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/33&quot;&gt;views&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/38&quot;&gt;template&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/free_tags/advanced&quot;&gt;advanced&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Tue, 20 Apr 2010 12:12:17 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">160 at http://joetsuihk.com</guid>
  </item>
  <item>
    <title>修改首頁的template</title>
    <link>http://joetsuihk.com/en/node/140</link>
    <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;你可以使用一個和其他頁面完全不同的首頁, 只要你能應用 template suggestion.&lt;/p&gt;
&lt;p&gt;打開你的theme_developer module, 指一下首頁,&lt;br /&gt;
你便會發現frontpage 是有一個特別的suggestion: page-front.tpl.php&lt;/p&gt;
&lt;p&gt;你只要在你的theme folder 內建立/複製一個page-front.tpl.php,&lt;br /&gt;
然後你便可以開始加特別的class 到body,&lt;br /&gt;
或者使用完全不同的region (front-left, front-mid-left, front-mid-right, front-right)&lt;br /&gt;
把首頁變作4欄以應付首頁大量資料的需求&lt;/p&gt;
&lt;p&gt;p.s. 記得清空你的cache 以使用新增的page-front.tpl.php&lt;br /&gt;
p.p.s 你當然也可以使用panels 之類的模組完成相同的效果&lt;/p&gt;
&lt;p&gt;原文: &lt;a href=&quot;http://drupal.org/node/317461&quot;&gt;http://drupal.org/node/317461&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-taxonomy-vocabulary-2 field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Free tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/38&quot;&gt;template&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/62&quot;&gt;frontpage&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Tue, 05 Jan 2010 16:38:14 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">140 at http://joetsuihk.com</guid>
  </item>
  <item>
    <title>Theming search form, 搜尋框的模版</title>
    <link>http://joetsuihk.com/en/node/110</link>
    <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;&lt;img src=&quot;http://www.joetsuihk.com/files/theming-search-form.gif&quot; /&gt;&lt;/p&gt;
&lt;p&gt;因為 drupal 原本內建的search form 搜尋框實在太單調的關係,&lt;br /&gt;
修改一下它的外觀, 模版...&lt;/p&gt;
&lt;p&gt;當然, 先打開 search module(今天的主角), devel module, theme developer(開發用主角)&lt;br /&gt;
將search block 放到 sidebar,&lt;br /&gt;
用 theme developer 指一下,&lt;br /&gt;
便知道 search module 已經內建了搜尋框的 template 以供使用, 修改&lt;br /&gt;
search-block-form.tpl.php 是在 block 之內的 template&lt;br /&gt;
search-theme-form.tpl.php 便是其他情況下使用的 template&lt;br /&gt;
可以直接到 [base_path]/module/search 之內&lt;br /&gt;
複製所需的template 到你的 theme 之內&lt;br /&gt;
清空你的 cache 緩存, 你的theme 便會自動使用這個你新增的 template 檔了&lt;/p&gt;
&lt;p&gt;其實一個搜尋框只有三種元素 (element)&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-taxonomy-vocabulary-2 field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Free tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/free_tags/theming&quot;&gt;theming&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/29&quot;&gt;Drupal6.x&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/37&quot;&gt;search form&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/en/taxonomy/term/38&quot;&gt;template&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-add-this field-type-addthis field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a class=&quot;addthis_button &quot; addthis:title=&quot;Theming search form, 搜尋框的模版 - JOE Tsui&amp;#039;s Drupal life in Hong Kong (香港)&quot; addthis:url=&quot;http://joetsuihk.com/en/node/110&quot;&gt;&lt;img src=&quot;http://s7.addthis.com/static/btn/sm-share-en.gif&quot; alt=&quot;Share page with AddThis&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Sun, 07 Sep 2008 09:12:05 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">110 at http://joetsuihk.com</guid>
  </item>
  </channel>
</rss>
