User login

Ask Agaric: Starting out theming in Drupal

Totally deprecated, we now generally recommend starting with http://drupal.org/project/zen

Finding out how to theme in Drupal is not as self-explanatory as one might hope. One experienced designer e-mailed us:

So I've been looking around the Drupal site. Just to be sure of the type of coding that I am doing, tell me if I'm on the right track:

The site needs to be coded in HTML using 'div' tags instead of 'table' and CSS.

The pages that need to have PHP in them will be created later and added to the already coded pages.

If so, I will get started coding.

We wrote back: "Actually, not really."

Then we thought a bit more explanation might be in order, so Ask Agaric brings you the Agaric Guide to Beginning Theming with Drupal. (We'll alternately spell it themeing in order to pull in search engine hits from the generous spellers among us.)

There's a ton of different approaches to creating themes for Drupal. We're not sure about the method described above, but clearly one thread was by a designer very much against tables. (Possibly the process described came from part of the site for module developers, who should be outputting simple div tags that can be re-themed with css, or even as tables, by designers creating themes.)

While Drupal themes certainly can be designed without tables (one of the core themes, chameleon, is CSS only), the default theme (bluemarine) does use tables.

We've attached page.tpl.php (from bluemarine in this case) which is what creates the overall framework for every Drupal page (there is a Drupal module called frontpage which will let you replace the front page with a completely custom page, if you want a very specialized layout for the front page only-- this may be the easiest way for traditional designers to start, and not get hung up on the Drupal-specific theme needs until after their concept and design is complete).

Page.tpl.php (tpl for template) uses tables in this case, and there's hardly anything to it. Style.css has a bit more to it, but you the designer can just modify what you want, as you need to.

We would recommend someone new to themeing for Drupal start with bluemarine, as available in a download of Drupal, and modify style.css and page.tpl.php (the attached files) to make it look how you like. It's the

<?php
 
?>

parts of page.tpl.php that you do not want to change, so that all the parts of a drupal page -- header, sidebar(s), primary and secondary links (meaning top-level site links and second-level links are children of the top-level links.)

Some FTP programs such as CuteFTP on Windows or CyberDuck on Mac will even let you edit files right on the server, so you can see your changes right away with a browser refresh. (NOT for live sites; demos only.)

Don't let any of this stop you from starting your design, especially with the frontpage module which will allow the front page to be distinct and separate from the Drupal-powered site.

Ask Agaric should return with more about the easiest way to theme a Drupal site. Remember this is just beginning to theme: page.tpl.php controls the page structure, the template for the site, but just about everything about Drupal can be themed, the output of each module-- but that's a lot more complicated.

Enjoy your introduction to Drupal!

Totally deprecated, we now generally recommend starting with http://drupal.org/project/zen

Finding out how to theme in Drupal is not as self-explanatory as one might hope. One experienced designer e-mailed us:

So I've been looking around the Drupal site. Just to be sure of the type of coding that I am doing, tell me if I'm on the right track:

The site needs to be coded in HTML using 'div' tags instead of 'table' and CSS.

The pages that need to have PHP in them will be created later and added to the already coded pages.

If so, I will get started coding.

We wrote back: "Actually, not really."

Then we thought a bit more explanation might be in order, so Ask Agaric brings you the Agaric Guide to Beginning Theming with Drupal. (We'll alternately spell it themeing in order to pull in search engine hits from the generous spellers among us.)

There's a ton of different approaches to creating themes for Drupal. We're not sure about the method described above, but clearly one thread was by a designer very much against tables. (Possibly the process described came from part of the site for module developers, who should be outputting simple div tags that can be re-themed with css, or even as tables, by designers creating themes.)

While Drupal themes certainly can be designed without tables (one of the core themes, chameleon, is CSS only), the default theme (bluemarine) does use tables.

We've attached page.tpl.php (from bluemarine in this case) which is what creates the overall framework for every Drupal page (there is a Drupal module called frontpage which will let you replace the front page with a completely custom page, if you want a very specialized layout for the front page only-- this may be the easiest way for traditional designers to start, and not get hung up on the Drupal-specific theme needs until after their concept and design is complete).

Page.tpl.php (tpl for template) uses tables in this case, and there's hardly anything to it. Style.css has a bit more to it, but you the designer can just modify what you want, as you need to.

We would recommend someone new to themeing for Drupal start with bluemarine, as available in a download of Drupal, and modify style.css and page.tpl.php (the attached files) to make it look how you like. It's the

<?php
 
?>

parts of page.tpl.php that you do not want to change, so that all the parts of a drupal page -- header, sidebar(s), primary and secondary links (meaning top-level site links and second-level links are children of the top-level links.)

Some FTP programs such as CuteFTP on Windows or CyberDuck on Mac will even let you edit files right on the server, so you can see your changes right away with a browser refresh. (NOT for live sites; demos only.)

Don't let any of this stop you from starting your design, especially with the frontpage module which will allow the front page to be distinct and separate from the Drupal-powered site.

Ask Agaric should return with more about the easiest way to theme a Drupal site. Remember this is just beginning to theme: page.tpl.php controls the page structure, the template for the site, but just about everything about Drupal can be themed, the output of each module-- but that's a lot more complicated.

Enjoy your introduction to Drupal!

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.