<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>笨活儿 &#187; 主题</title> <atom:link href="http://blog.benhuoer.com/tag/%e4%b8%bb%e9%a2%98/feed" rel="self" type="application/rss+xml" /><link>http://blog.benhuoer.com</link> <description>请用力生活</description> <lastBuildDate>Mon, 02 Jan 2012 16:05:26 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>[Drupal模板制作手册-3]子主题，结构与继承</title><link>http://blog.benhuoer.com/posts/sub-themes-their-structure-and-inheritance.html</link> <comments>http://blog.benhuoer.com/posts/sub-themes-their-structure-and-inheritance.html#comments</comments> <pubDate>Sun, 10 Aug 2008 12:22:00 +0000</pubDate> <dc:creator>慵云</dc:creator> <category><![CDATA[前端开发]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[drupal]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[主题]]></category> <category><![CDATA[模板]]></category> <category><![CDATA[继承]]></category> <guid
isPermaLink="false">http://jackoko.cn/?p=149</guid> <description><![CDATA[子主题(sub-theme)和其他主题基本一样，只有一个区别：它们可以继承父主题(parent-theme)的资源(如CSS和JavaScript文档、icon图标等)。在父主题给子主题的资源传递链上，没有传递层级的限制。一个主题可以是另一个子主题的子主题，并且可以分支出N个它自己的子主题，没有个数和层级的限制。 想象一下从设计一个基本主题(base theme)作为模型开始， 然后添加一些子主题，在子主题上完善你的网页样式。再然后，依据这同一个模型，试试分支出一些其他样式的子主题。需要同时建立多个站点，但是需要有共性的外观感觉？ 有了子主题功能，一系列设计资源都可以共享. 特定站点外观可以组织到特定的子主题中，但是一旦需要改变某个共同特性，只需要编辑一次共有资源中的某项，即可应用到所有主题。只要规划得当，此功能可以给你带来无限可能。 要声明一个父主题，或成为“基本主题”，将下列语句添加到子主题的.info文件中，“themeName”替换为您的父主题的内部名字。 base theme = themeName 下列资源会被继承: 父主题中定义的所有样式表，但是这也是可以通过某些选项来控制的。 父主题中定义的所有JavaScripts。 所有的模板文件(.tpl.php)。 文件&#8221;template.php&#8221;中定义的所有内容。包括主题函数重写, 预处理器和其他所有东西。所有子主题把它自己的template.php文件和父主题的该文件包含在一起。 父主题的截图，只要.info文件使用了和他的父主题一样的设置。 下列资源不会被继承： 为父主题制定的logo.png文件。不包括用户上传的logo，因为他们总是会被使用。 .info文件定义的某些设置。 This includes regions. If you are not using the default regions, then make sure your &#8220;page.tpl.php&#8221; file for the sub-theme matches what is set for regions in the .info file. Each base and sub-theme can [...]<div
class="related-post"> <strong>你应该也会喜欢：</strong><ol><li><a
href="http://blog.benhuoer.com/posts/anatomy-of-a-drupal-theme.html" rel="bookmark">[Drupal模板制作手册-2]主题的解剖</a></li><li><a
href="http://blog.benhuoer.com/posts/info-files-for-themes.html" rel="bookmark">[Drupal模板制作手册-4]主题的.info文件</a></li><li><a
href="http://blog.benhuoer.com/posts/drupal-overriding-themable-output.html" rel="bookmark">[Drpal模板制作手册-5]重写可主题化的输出</a></li><li><a
href="http://blog.benhuoer.com/posts/drupal_theming_overview.html" rel="bookmark">[Drupal模板制作手册-1]主题定制概述</a></li><li><a
href="http://blog.benhuoer.com/posts/40-stand-alone-javascript-libraries-for-specific-purposes.html" rel="bookmark">40个实用的轻量级JavaScript库[SM]</a></li></ol></div> ]]></description> <content:encoded><![CDATA[<p>子主题(sub-theme)和其他主题基本一样，只有一个区别：它们可以继承父主题(parent-theme)的资源(如CSS和JavaScript文档、icon图标等)。在父主题给子主题的资源传递链上，没有传递层级的限制。一个主题可以是另一个子主题的子主题，并且可以分支出N个它自己的子主题，没有个数和层级的限制。</p><p
style="TEXT-ALIGN: center"><img
class="aligncenter" src="http://drupal.org/files/sub-theme_branching.png" alt="sub-themes and dependancies" /></p><p><span
id="more-149"></span></p><p>想象一下从设计一个基本主题(base theme)作为模型开始， 然后添加一些子主题，在子主题上完善你的网页样式。再然后，依据这同一个模型，试试分支出一些其他样式的子主题。需要同时建立多个站点，但是需要有共性的外观感觉？ 有了子主题功能，一系列设计资源都可以共享. 特定站点外观可以组织到特定的子主题中，但是一旦需要改变某个共同特性，只需要编辑一次共有资源中的某项，即可应用到所有主题。只要规划得当，此功能可以给你带来无限可能。</p><p>要声明一个父主题，或成为“基本主题”，将下列语句添加到子主题的<a
href="http://drupal.org/node/171205">.info文件</a><code>中，“themeName”</code>替换为您的父主题的<strong>内部名字</strong>。</p><div
class="codeblock"><code>base theme = themeName<br
/> </code></div><p>下列资源会被继承:</p><ul
id="sub-theme-inherit"><li>父主题中定义的所有<a
href="http://drupal.org/node/171209">样式表</a>，但是这也是可以通过某些<a
href="http://drupal.org/node/171209#styles-override-parent">选项</a>来控制的。</li><li>父主题中定义的所有<a
href="http://drupal.org/node/171213">JavaScripts</a>。</li><li>所有的模板文件(.tpl.php)。</li><li>文件&#8221;template.php&#8221;中定义的所有内容。包括<a
href="http://drupal.org/node/173880#function-override">主题函数重写</a>, <a
href="http://drupal.org/node/223430">预处理器</a>和其他所有东西。所有子主题把它自己的template.php文件和父主题的该文件包含在一起。</li><li>父主题的截图，只要.info文件使用了和他的父主题一样的设置。</li></ul><p>下列资源不会被继承：</p><ul
id="sub-theme-not-inherit"><li>为父主题制定的logo.png文件。不包括用户上传的logo，因为他们总是会被使用。</li><li>.info文件定义的某些设置。 This includes regions. If you are not using the default regions, then make sure your &#8220;page.tpl.php&#8221; file for the sub-theme matches what is set for regions in the .info file. Each base and sub-theme can have their own region settings.</li><li>Anything set within the &#8220;theme-settings.php&#8221; file for the <a
href="http://drupal.org/node/177868">主题高级设置</a>.</li><li>Anything set within the &#8220;color&#8221; directory for <a
href="http://drupal.org/node/108459">color模块支持</a>.</li></ul><p><em
class="tips">Note that sub-themes can be placed outside of the base theme&#8217;s directory or within it. Before version 6, they had to be in the sub-directory of the parent theme.</em></p><div
class="related-post"> <strong>你应该也会喜欢：</strong><ol><li><a
href="http://blog.benhuoer.com/posts/anatomy-of-a-drupal-theme.html" rel="bookmark">[Drupal模板制作手册-2]主题的解剖</a></li><li><a
href="http://blog.benhuoer.com/posts/info-files-for-themes.html" rel="bookmark">[Drupal模板制作手册-4]主题的.info文件</a></li><li><a
href="http://blog.benhuoer.com/posts/drupal-overriding-themable-output.html" rel="bookmark">[Drpal模板制作手册-5]重写可主题化的输出</a></li><li><a
href="http://blog.benhuoer.com/posts/drupal_theming_overview.html" rel="bookmark">[Drupal模板制作手册-1]主题定制概述</a></li><li><a
href="http://blog.benhuoer.com/posts/40-stand-alone-javascript-libraries-for-specific-purposes.html" rel="bookmark">40个实用的轻量级JavaScript库[SM]</a></li></ol></div><div
style="border-top:dashed 1px #ccc;  border-bottom:dashed 1px #ccc;padding:0.3em 0;">分类于：<a
href="http://blog.benhuoer.com/category/web-technology/web-apps-development" title="查看 前端开发 中的全部文章" rel="category tag">前端开发</a>        标签: <a
href="http://blog.benhuoer.com/tag/css" rel="tag">CSS</a>, <a
href="http://blog.benhuoer.com/tag/drupal" rel="tag">drupal</a>, <a
href="http://blog.benhuoer.com/tag/javascript" rel="tag">JavaScript</a>, <a
href="http://blog.benhuoer.com/tag/%e4%b8%bb%e9%a2%98" rel="tag">主题</a>, <a
href="http://blog.benhuoer.com/tag/%e6%a8%a1%e6%9d%bf" rel="tag">模板</a>, <a
href="http://blog.benhuoer.com/tag/%e7%bb%a7%e6%89%bf" rel="tag">继承</a></div><p><small>©2008 <a
href="http://blog.benhuoer.com" target="_blank">笨活儿</a> | <a
href="http://blog.benhuoer.com/posts/sub-themes-their-structure-and-inheritance.html" target="_blank">永久链接</a> | <a
href="http://blog.benhuoer.com/posts/sub-themes-their-structure-and-inheritance.html#comments" target="_blank">板凳还在</a> | <a
href="http://9.douban.com/recommend/?url=http://blog.benhuoer.com/posts/sub-themes-their-structure-and-inheritance.html&title=[Drupal模板制作手册-3]子主题，结构与继承&v=1&n=1" target="_blank">推荐到豆瓣</a> <br/> </small></p>]]></content:encoded> <wfw:commentRss>http://blog.benhuoer.com/posts/sub-themes-their-structure-and-inheritance.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
