第三部分 Drupal的美化

回首页

Make it look better: themes & theming

让她看起来更美,主题和制作

Do you have a custom design to implement or are you looking for a fresh look with an out of the box theme?

网站如人,美之,可也。

Design and Drupal, introduction to theming

设计和Drupal,主题介绍

Finding themes

寻找主题

Installing themes

安装主题

Theme HowTos

如何做主题


Design and Drupal, introduction to theming

设计和Drupal,主题介绍

This community documentation guide is about changing the look and feel of a Drupal site. The guide coversDrupal 6 & 7andDrupal 8.

Changing Site Appearance

In the administrative settings you can modify the appearance of the theme in three ways:

Find a prefabricatedtheme provided by the Drupal communityor get one on a third-party website and modify the theme settings

Copy anexisting themeand then change or extend the code

Build a complete theme from scratch (For doing this you need to copy files from core theme and place it under sites/all/themes and do the necessary changes on .info, template, tpl and css files.)

What else can you do?

You can do more with a theme than change the appearance of an entire site. It is also possible to "theme" specific sections of a site, certain types of content, or even individual pages. For example, your theme could specify a different look for just the front page of your site.

Some other things that you can do with a theme:

Change layouts, regions, images and fonts.

Hide or display fields based on user role.

Dynamically respond to changes in content or user input.

Modify or replace text (e.g. labels or attributes) and variables generated by modules.

It's also possible toportopen source designs between other systems (Joomla!templates,WordPressthemes, etc.) and Drupal, orconvertany website layout or template into a Drupal theme.

Create a sub-theme. Your own version of a theme (existing or one that you create) that you can modify, while protecting the functionality of the original (base-theme) for update purposescreating a sub-theme.

Other Places to Explore

Overview of theme files -Structure of Drupal 6 and Drupal 7 themes files individuallyhttps://drupal.org/node/171194

Definitive Guide to Drupal 7 Theming -(Theming and Advanced Theming chapters from the Definitive Guide to Drupal 7) free online:http://themery.com/dgd7

Installing Themes -To install existing, contributed themes, please visitInstalling themes.

Contributed Themes -FreeContributed themesat drupal.org. See demos of some of them atTheme Garden. Drupal 7 themes can be previewed atdrupal7themes.arxic.com.

Custom Themes -Unique custom themes created byDrupal designersthat you can hire.

Theming Tutorials -View a number oftheming videoswhich guide you through common scenarios.

Support -Having problems? Check thetroubleshooting FAQ, in thetheming forumor contact us on IRC @ #drupal-themes.

Module Developer's Guide -Module developers can consult the module developer's guide, specificallyUsing the theme layer (Drupal 7.x)and(Drupal 6.x).

HTML and CSS techniques -See thebest practices page.

Sass techniques -See theSass Techniques and tools.

Theming Drupal 8

Theming Drupal 6 and 7

Tools, best practices and conventions

Upgrading a theme to a new version

Create custom twig templates from custom module

More theming resources and guides

Theme HowTos

Theme snippets

Core themes

Contributed themes


Finding themes

寻找主题

本章无内容, 点击英文标题就可以寻找了。


Installing themes

安装主题

Installing themes

Last updated November 4, 2015. Created on September 16, 2007.

Edited bymgosur,NewSites,peterx,davidneedham.Log in to edit this page.

Download the theme.

You can find themes onhttp://drupal.org/project/themes, as well as some external sites. Make sure the version of the theme matches your version of Drupal. Note that themes labeled "DEV" are in a development stage. They may be written for a previous/current/future version of Drupal, and they are considered unstable and should be handled with care.

Extract the files.

When you first get the theme, it will appear in a compressed file format such as 'tar.gz'. On Windows, use a program like 7-Zip to extract it. On the Mac, you can use Stuffit Expander. To extract the file using the Unix command line:

tar-zxvf themename-drupalversionnumber.tar.gz

You should see a list of files extracted into a folder.

Upload the folder.

FTP/Copy/SCP your files to the desired themes folder in your Drupal installation. Since thethemes folder at the top level of Drupal is reserved for Drupal core themes, you should create asites/all/themes/directory for contributed (non-core) themes and put uploaded themes there. If you are running amulti-site installationof Drupal, you can create a themes folder under sites/my.site.folder and put themes there that are specific to a particular site in your installation. Themes that will be shared between all sites should be placed in sites/all/themes.

Read the directions.

If the theme has an installation file (usually INSTALL.txt and/or README.txt), read it for specific instructions. There are themes that require special treatment to function properly.

Enable the theme.

Go to "Appearance" on the main Administration menu of your site. Check the 'Enabled' box next to the theme.

Optional: Make it the active, default theme.

Check the 'default' box to make this the chosen theme for your site. Enabled alone will allow users to select the theme, if you have allowed that permission.

Click the 'Save Configuration' button at the bottom.

If you run into problems, check the themes issue queue and search the forums. If your problem hasn't already been addressed, post a question and someone will try to help you out.

Drupal 8

Drupal 8 places all core code and themes under a directory named/core./themes,/sites/all/themes, and the other Drupal 7 options are still available for your themes.

The themes still download and expand the same. When you look inside, the main differences are:

The.infofile changes to.info.yml.

The.tpl.phpfiles change to.html.twig.

The following is the README.txt from Drupal 8 directory/themes.

Place downloaded and custom themes that modify your site's appearance in this

directory to ensure clean separation from Drupal core and to facilitate safe,

self-contained code updates. Contributed themes from the Drupal community may

be downloaded athttp://drupal.org/project/themes.

It is safe to organize themes into subdirectories and is recommended to use

Drupal's sub-theme functionality to ensure easy maintenance and upgrades.

In multisite configuration, themes found in this directory are available to

all sites. In addition to this directory, shared common themes may also be kept

in the sites/all/themes directory and will take precedence over themes in this

directory. Alternatively, the sites/your_site_name/themes directory pattern may

be used to restrict themes to a specific site instance.

Refer to the "Appearance" section of the README.txt in the Drupal root

directory for further information on theming.

AttachmentSize

screencap-choose-a-theme.jpg336.16 KB


Theme HowTos

Last updated October 24, 2014. Created on May 13, 2005.

Edited bycamorim,Heine,SLIU,LeeHunter.Log in to edit this page.

The following section provides a collection of 'How-to' articles on subjects relevant to theme developers. For a selection of useful code samples, see theTheme Snippetssection.

Add Default Menu to node without menu

Change the favicon

Clearing floats with class="clear-block"

Collapsing default fieldsets: Tidying up the theme settings form

Convert any website layout or template into a Drupal theme - easily!

Create a Views event list grouped by month

Create a new custom theme with CSS alone

Create a web / ipad / facebook page friendly site with the zeropoint theme

Creating and rendering CSS templates (eg. style.css.php)

Creating automation tools for custom themes (Gulpjs)

Custom ul list-style

Customize Drupal User Profiles with CiviCRM Contact Fields

Customize the User Edit page in Drupal 7 - an example

Customize the front page template

Customizing core and/or contributed themes

Displaying random images

Drupal8: HOWTO detect whether an entity reference field is a taxonomy term reference and flag it for targeting in field.html.twig and your CSS

Dynamic Image Headers through Taxonomy Terms

Enable submit via Enter key on Ajax forms

Hide the Node Title on a Page (6.x)

How To Add Most Recent Blog Entries by User List to Users Profile Page

How to edit ALT tag on your site logo

How to use images for NEXT and PREV links

Image stretch in Internet Explorer

Look and feel

Move the help/description text on node forms

Moving $tabs to a new region -- made easy

Overriding Theme Templates in Drupal 6 and 7

Porting A Joomla Template To Drupal - a simple approach.

Prototyping XHTML/CSS with Drupal

Put an HTML non breaking space ( ) in menu items titles

Recipe for two column block of recent comments

Rounded Corners in Drupal 7 (jquery corner)

Static and Dynamic Thumbnails for Facebook

Style a horizontal login block in the footer

Subtheming Quick and Dirty

Theming CCK fields within a content type

Theming Web-Form

Tips for designing themes in Dreamweaver, GoLive etc.

Using the CSS Template module

Welcome User custom block



最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,839评论 6 482
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,543评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 153,116评论 0 344
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,371评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,384评论 5 374
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,111评论 1 285
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,416评论 3 400
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,053评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,558评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,007评论 2 325
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,117评论 1 334
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,756评论 4 324
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,324评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,315评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,539评论 1 262
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,578评论 2 355
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,877评论 2 345

推荐阅读更多精彩内容

  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 13,433评论 5 6
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,399评论 0 23
  • 清明时节灰朦朦,路上行车慢腾腾。 借问哭声哪里有?坟头团聚喜乐多。 今时早不同往日,过去因苦而生悲。 今人早已看通...
    郝逗阅读 379评论 2 2
  • 早上起床和小朋友一起收拾了家,我们就开车回奶奶家了,今天的任务是贴春联和挂灯笼,小时候最发愁的任务就是这个了,如果...
    甜菜的眼泪阅读 269评论 0 1
  • 简书的排版很舒适,让人很喜欢。 总觉得以后人类的生活简单精致就是常态。 世界本就繁华,如果能把自己的生活过得简单而...
    锂大欣阅读 70评论 0 0