<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="http://joetsuihk.com/zh-hant/taxonomy/term/102/all" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>preprocess</title>
    <link>http://joetsuihk.com/zh-hant/taxonomy/term/102/all</link>
    <description></description>
    <language>zh-hant</language>
     <atom:link href="http://joetsuihk.com/zh-hant/taxonomy/term/102/all/feed" rel="self" type="application/rss+xml" />
      <item>
    <title>提供&quot;可使用的 tpl 檔&quot; Working with template suggestion</title>
    <link>http://joetsuihk.com/zh-hant/%E6%8F%90%E4%BE%9Bquot%E5%8F%AF%E4%BD%BF%E7%94%A8%E7%9A%84_tpl_%E6%AA%94quot_working_template_suggestion</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;a href=&quot;/template_preprocess_drupal_6x&quot;&gt;Preprocess function&lt;/a&gt; 的另一個少用但重要的功能就是提供 &lt;strong&gt;&quot;可使用的 tpl 檔&quot;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;簡單點說明, Drupal 本身已經提供的 page-story.tpl.php 就是 temple_preprocess_page() 提供的&lt;br /&gt;
同樣, page-front.tpl.php 都是由 drupal 自帶的 temple_preprocess_page 提供&lt;/p&gt;
&lt;p&gt;或者用 node.tpl.php 做例子,&lt;br /&gt;
Drupal 自帶的 template_preprocess_node() 提供 node-[nid].tpl.php 作為 &lt;strong&gt;&quot;可使用的 tpl 檔&quot;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;當然, 我們的目的是提供一種 Drupal 沒有自帶的 tpl 命名方式,&lt;br /&gt;
例如另一種 content-type 的 tpl 命名: node-type-[type].tpl.php:&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;/zh-hant/free_tags/preprocess&quot;&gt;preprocess&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/zh-hant/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;/zh-hant/free_tags/templatesuggestion&quot;&gt;template suggestion&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Mon, 03 May 2010 13:33:56 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">167 at http://joetsuihk.com</guid>
  </item>
  <item>
    <title>模版的預處理 template preprocess in Drupal 6.x</title>
    <link>http://joetsuihk.com/zh-hant/%E6%A8%A1%E7%89%88%E7%9A%84%E9%A0%90%E8%99%95%E7%90%86_template_preprocess_drupal_6x</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;繼續 Drupal templates 的深度遊&lt;/p&gt;
&lt;p&gt;Preprocess 是一個在你的theme 之內的 template.php 內的一組函數&lt;br /&gt;
用&quot;一組&quot; 的原因是因為一個theme 是可以有很多 preprocess function&lt;br /&gt;
正確來講, 一個 &lt;a href=&quot;http://www.joetsuihk.com/module_development_introduction_moduleinfo&quot;&gt;hook&lt;/a&gt; 便已經可以有10個 preprocess function (當然, 和 hook 一樣, 不用也是可以的)&lt;/p&gt;
&lt;p&gt;而preprocess 的真正功用是,&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;為 templates 提供更多的變數以供使用&lt;/li&gt;
&lt;li&gt;為hook 提供更多的template suggestion&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;第一點的功能很明顯, 因為 drupal 內建的 preprocess function (無錯, Drupal core 都是使用 preprocess 的)沒法為你的theme 的特殊性供你需要的變數&lt;br /&gt;
你便可以使用preprocess function:&lt;/p&gt;
&lt;p&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;/zh-hant/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;/zh-hant/free_tags/preprocess&quot;&gt;preprocess&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/zh-hant/free_tags/drupal6x&quot;&gt;Drupal 6.x&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/zh-hant/free_tags/templatesuggestion&quot;&gt;template suggestion&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Mon, 26 Apr 2010 13:40:02 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">165 at http://joetsuihk.com</guid>
  </item>
  <item>
    <title>進階 views 模版(二): HTML 列表 Complex views templating, part 2, table, HTML list templates</title>
    <link>http://joetsuihk.com/zh-hant/%E9%80%B2%E9%9A%8E_views_%E6%A8%A1%E7%89%88%E4%BA%8C_html_%E5%88%97%E8%A1%A8_complex_views_templating_part_2_table_html_list_templates</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;a href=&quot;http://www.joetsuihk.com/complex_views_templating_part_1_intro_config_tpl&quot;&gt;part1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;補一下 table 顯示之下的 theming.&lt;br /&gt;&lt;img src=&quot;http://www.joetsuihk.com/files/theming-views2-1.png&quot; /&gt;&lt;br /&gt;
假如你的 table 有4個 fields, views 的 theming information 便有6個 templates:&lt;br /&gt;
1個 display 的 tpl (page 或block)&lt;br /&gt;
1個 style tpl, 包含了 &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt;&lt;br /&gt;
每1個 field 都可以有一個自己的 tpl (詳見 attachment)&lt;/p&gt;
&lt;p&gt;HTML list (ul, ol) 也是同樣的情況&lt;br /&gt;
display + style tpl, 外加每個field 一個tpl&lt;br /&gt;
也可以做 field by field 的 tpl, 修改 &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; 的class, &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt;多個 span 之類&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;/zh-hant/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;/zh-hant/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;/zh-hant/free_tags/templates&quot;&gt;templates&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/zh-hant/free_tags/preprocess&quot;&gt;preprocess&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/zh-hant/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;/zh-hant/free_tags/pager&quot;&gt;pager&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Mon, 26 Apr 2010 13:39:12 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">164 at http://joetsuihk.com</guid>
  </item>
  </channel>
</rss>
