Hello,

I'm new to Drupal, but it looks promising as it is very small and effecient.

My current project before switching to Drupal as my primary CMS is to figure out several things. The first is:
How do I modify a theme for a module?

Example: Instead of the navigation bar for the book module belonging to the bottom of a page, I want to have it at the top of the page. How do I modify the layout to reflect this change?

Or for a forum I'd like to include the information output of a custom SQL statement to show the current number of posted articles, etc.

Just two examples. But the idea should be clear: I not only want to modify the standard layout of a site like it's possible with Xtemplate, but also to give several modules a personal touch.

Best regards,

Bernhard

Comments

Bèr Kessels’s picture

From the way you phrase your questions, I understand that you need to learn a little more about Drupals inner workings before you can start theming. That is not bad at all, but after learning a bit more, you can target your support questions a bit better, and thus get better answers,

Theming is the last layer on top of all the data. We do not theme modules, but output. We theme the data that modules present.

I would advice you to start with phptemplate, because that is far better documented and is easier to learn.

Read some more here: http://drupal.org/phptemplate and here: http://drupal.org/node/11774

---
Professional | Personal
| Sympal: Development and Hosting

MacONet’s picture

I've read a little bit more about the documentation (it really misses some beginner examples, btw), and I got this impressions:

Drupal defines certain elements placed on a page by name. E.g. breadcrumb, body etc. The layout is done in the page.tpl.php?

You define additional styles for page elements, like "box", "comment", etc. in corresponding template files.

However, you CANNOT modify how a module renders content into a body! Right?

E.g. the book module ALWAYS renders the navigation to the breadcrumb. If you want to have a navigation at the top AND bottom of the node, you need to modify the module's code???
Or is the solution to define a different page template for the book node? (node-book.tpl.php?) and define two breadcrumb regions?

I hope I didn't got it too much wrong. I'm coming from TikiWiki, where each module has it's own PHP template defining exactly where content is rendered for modules in the modules' content box of the page layout.

Best regards, Bernhard

eaton’s picture

Most modules do all their rendering in theme_modulename_foo() functions. In addition to the page.tpl.php files and so on, your Drupal theme can also have a template.php file.

In that template.php file, the function mytheme_modulename_foo() would override the default theme_modulename_foo() function and let you alter where stuff is put, how the HTML looks, and so on.

--
Jeff Eaton | I heart Drupal.

--
Eaton — Partner at Autogram

turin’s picture

I have such a problem too. I'm using image.module and I'm trying to have pages themed in diferent way when there are images in them.
OK, in image.module there are functions theme_image_*, but they control the way the story block is displayed.
And I cannot see a way to tell Drupal to hise some blocks when displaying node with an image.
I could theme the image and it's decorations etc, but not the whole page.
I'm sure I just don't understand well something abouth themes. Please if you could explain more it'll be great. Let's take the case with images and pages. I think it'll help MacONet too.