if ($title): ?>
print $title; ?>endif; ?>
if ($tabs): ?>print $tabs; ?>endif; ?>
if ($show_messages): print $messages; endif; ?>
print $help; ?>
print $content; ?>
Footer: Add footer and footer message
To add a footer region and the footer message you have set in the administration backend you can use:
if ($footer_message || $footer) : ?>
endif; ?>
Add a final tag at the bottom of your theme
Paste the following at the end of your page.tpl.php file. You must
have this tag at the bottom, which will dynamically include any scripts
that need to appear at the bottom of the page, as well as close up any
loose ends and tags that might have been left open:
print $closure; ?>
For Drupal 6: Create a YourThemeName.info file
Lastly, in Drupal 6, the one final element is to create a YourThemeName.info file (where YourThemeName
is the name of your theme, with no spaces). Simply make a blank file
and paste the following code into it, customize it with the appropriate
name/description, and save it in the same directory along with the rest
of your theme's template files:
name = YourThemeName
description = Description of YourTheme
core = 6.x
engine = phptemplate
stylesheets[all][] = style.css
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
The "regions" portion after style.css includes all of
Drupal's "standard" regions, and is recommended so that you can easily
remove regions you don't want to use, or add custom regions. If you want
to add custom regions, you must manually include any of the default
ones you wish to keep as well or the defaults will disappear from your
theme (simply copy/paste them from this page or another theme). If you
want to add a custom region, simply copy one of the region lines and rename it.
That's all - Paste the above bits of code into ANY site layout or template, and you have a basic, functional Drupal theme.
Learning more about Drupal theming
There are quite a few more elements you could use in your theme if
you want to. Here are a number of excellent resources for learning the
more detailed aspects of theming in Drupal:
- Full listing of available to choose from for page.tpl.php.
- Full listing of available to choose from for page.tpl.php.
-
- this is a fantastic article, including screenshots and diagrams to
help you clearly understand how Drupal's theming system works.
- - Official theming guide on Drupal.org
Framework / Base / Starter themes
There are a variety of Framework themes (also known as Base or Starter
themes), the purpose of which is to serve as a "blank slate" Drupal
theme which you can build your own custom theme on top of. Many of these
themes are stripped of all unnecessary styling so that they are just
the core of a layout, paired with all the basic tpl.php
template files for Drupal without any special customizations. Many also
include a variety of helpful adjustments in their template.php files to
add in commonly sought fixes and tweaks, so you'll have them before you
even realize you need them. Several also add "extra" functionality that
does not come by default in Drupal.
You can use these themes as a clean and simple basis for your own
custom theme, or if you prefer, study them (and copy/paste from them) to
see how to get Drupal's functionality into your own completely custom
theme from scratch. Since these themes are clean and very lightly
styled, it will be easier to work with versus other themes that are
already highly customized.
Here is a list of many framework themes (though there may be more):
Additional note:
When converting an existing webpage that uses HTML references to conventional images, the references must be changed to avoid Drupal's tendancy to append "node/" to the front of relative paths.
Without any change, the new theme would change a reference into a reference.
Copy all of your original template's images into an images folder within the new theme's folder, and add the code print $base_path ?> to the front of the path to eliminate the "node/" appendage.
So an original HTML reference in the page being converted would now become print base_path() . path_to_theme(); ?>/images/myimage.jpg"/> where /images/ is a folder that you have created in the new theme for your new theme's images.
Thanks to idWorld for this solution
阅读(1589) | 评论(0) | 转发(0) |
if ($show_messages): print $messages; endif; ?>
print $help; ?>
print $content; ?>
Footer: Add footer and footer message
To add a footer region and the footer message you have set in the administration backend you can use:
endif; ?> Add a final tag at the bottom of your theme
Paste the following at the end of your page.tpl.php file. You must have this tag at the bottom, which will dynamically include any scripts that need to appear at the bottom of the page, as well as close up any loose ends and tags that might have been left open:
Lastly, in Drupal 6, the one final element is to create a YourThemeName.info file (where YourThemeName is the name of your theme, with no spaces). Simply make a blank file and paste the following code into it, customize it with the appropriate name/description, and save it in the same directory along with the rest of your theme's template files:
description = Description of YourTheme
core = 6.x
engine = phptemplate
stylesheets[all][] = style.css
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
The "regions" portion after style.css includes all of Drupal's "standard" regions, and is recommended so that you can easily remove regions you don't want to use, or add custom regions. If you want to add custom regions, you must manually include any of the default ones you wish to keep as well or the defaults will disappear from your theme (simply copy/paste them from this page or another theme). If you want to add a custom region, simply copy one of the region lines and rename it.
That's all - Paste the above bits of code into ANY site layout or template, and you have a basic, functional Drupal theme.
Learning more about Drupal themingThere are quite a few more elements you could use in your theme if you want to. Here are a number of excellent resources for learning the more detailed aspects of theming in Drupal:
- Full listing of available to choose from for page.tpl.php.
- Full listing of available to choose from for page.tpl.php.
- - this is a fantastic article, including screenshots and diagrams to help you clearly understand how Drupal's theming system works.
- - Official theming guide on Drupal.org
There are a variety of Framework themes (also known as Base or Starter themes), the purpose of which is to serve as a "blank slate" Drupal theme which you can build your own custom theme on top of. Many of these themes are stripped of all unnecessary styling so that they are just the core of a layout, paired with all the basic tpl.php template files for Drupal without any special customizations. Many also include a variety of helpful adjustments in their template.php files to add in commonly sought fixes and tweaks, so you'll have them before you even realize you need them. Several also add "extra" functionality that does not come by default in Drupal.
You can use these themes as a clean and simple basis for your own custom theme, or if you prefer, study them (and copy/paste from them) to see how to get Drupal's functionality into your own completely custom theme from scratch. Since these themes are clean and very lightly styled, it will be easier to work with versus other themes that are already highly customized.
Here is a list of many framework themes (though there may be more):
Additional note:
When converting an existing webpage that uses HTML references to conventional images, the references must be changed to avoid Drupal's tendancy to append "node/" to the front of relative paths.
Without any change, the new theme would change a reference into a reference.
Copy all of your original template's images into an images folder within the new theme's folder, and add the code print $base_path ?> to the front of the path to eliminate the "node/" appendage.
So an original HTML reference in the page being converted would now become print base_path() . path_to_theme(); ?>/images/myimage.jpg"/> where /images/ is a folder that you have created in the new theme for your new theme's images.
Thanks to idWorld for this solution