Help Creating Theme
Hi, all,
I am new to Drupal, and must say that I'm very impressed with the design and the obvious amount of brainpower that went into this.
I'm trying to create a theme, but there isn't enough documentation on how to do this.
The docs point me to the existing themes to see how they were written. While I understand the PHP just fine, the context in which it is running is completely missing for me, since I know nothing about drupal.
Examples:
* When does the node() function get called?
* I can see in the resulting browser code (using the Marvin) theme that 2 columns have been defined. It's not at all obvious to me how that is controlled from within the .theme file...
I have many other questions as well; but I assume I've missed a reference guide somewhere. I've read the Themes section of the Handbook and the Themes Developers Guide pages.
Can anybody help out a Drupal newb?
Thanks,
Gibby

Columns
Basically, the colums are defined in header and footer. At the end of the header function, you will see the beginning of a '<td>' statement. That's where marvin's first column begin. The content of that column is then generated by Drupal. Then to end that first column, the footer function begins with a '</td>' statement. The second column begins right away and contains 'theme_blocks("all", $this);' which displays the content of the second column (the blocks).
To summarize, when generating a page, Drupal calls 'header', generates the content of the page, then ultimately calls 'footer'. It's all logical, somehow.
As for node(), it is called whenever a node has to be generated. Whether it is on the front page or on an individual page. The $node argument contains all the information about the content to be generated.
Does it help?
addendum
The second column begins right away and contains 'theme_blocks("all", $this);' which displays the content of the second column (the blocks).
addendum: you can have 3 columns if you add another table column (
<td></td>) and, instead oftheme_blocks("all", $this), calltheme_blocks("left", $this)for the left andtheme_blocks("right", $this)for the right column. note that there has been discussion about supporting more that just 2, actuallyarbitrary blocks regions - see this (footnote 1) for more.
Thanks, ax, for the reply.
Thanks, ax, for the reply.
If I understand the bottom of that link correctly, in the 3-column case, the middle column's region is "all"? Am I correct in assuming that "all" doesn't mean "all" in that the "left" and "right" regions are specifically excluded?
The aim first comment in that thread makes sense to me. I do want to render boxes in the main area of my side differently than I do in the sidebars. The discussion of boxes vs blocks is thoroughly confusing, though... Can you help me by clarifying for me:
What is a box?
What is a block?
Thanks for your help,
Gibby
Thank you for the reply, kyvi
Thank you for the reply, kyvinh.
While I understand the mechanism for the engine calling user-defined functions like header() and footer() to abstract the page, your reply really helps me understand that the "control" of where boxes are rendered doesn't really exist (hence my confusion).
Now that you've told me that 'theme_blocks()' is for, I understand what is going on, thank you.
More questions, if you (or anyone else) feels up to it?
where did theme_blocks() come from? is there a list of theme functions? (the theme functions page doesn't seem to list it.) A place in the source to go to see what's available?
term definitions:
I'd like to know how the following differ from one another. When the documentation uses these terms its almost always assumed that these terms are already understood, or a circular definition is provided
* what's a node? "nodes are a conceptual "black box" to couple and manage different types of content..."
* what's a block? "Blocks are the boxes visible in the side bars on the left- and right-hand side of the website.... Example: Only show on node pages..."
?? I'm confused. What's a node page? Isn't every page a node? Is the box() function in a theme what is called when a "block" is to be rendered? If everything is a node, how come the node() function isn't called when I set my new site to marvin theme and view the source? HELLP
Sorry for so many questions; but hopefully you can see the nature of my problem. I'm going to keep plugging away at it, because I'm convinced once I get through the introductory learning wall--er, curve, Drupal will ultimately be able to do for me what I'm looking for.
Thanks in advance for your help
Gibby
More...
Alright, let's get organized...
Your node() will be called. Just create a new blog for example, then go to your blogs page and you will see your node...
The marvin theme should have all the functions you need to create your theme, so just dig in there and you'll have what you need.
Organizing your questions might help, because I don't know where to start
Questions
Exactly my problem-- where do I start? It's difficult to organize questions about a topic until one knows at least a little something about it. As I mentioned earlier, the documentation on drupal I'm reading assumes I already know the definition of the terms being used, yet I can find no place where they are defined
Maybe we could start there? How about definitions of the following 'drupal' terms, and an explanation of how they differ from each other?
* module, node
* block, box
* story, book
* site page, story, article
Not fully understanding these terms and their differences is preventing me (and I imagine, others) from being able to take advantage of what documentation there is.
Thanks for your help,
Gibby
Drupal Terminology
(If deemed appropriate could someone proofread this and add it to the documentation? -- Adam.)
As you start to read the Drupal documentation and learn how it works it will help a lot if you know what a few words mean.
General Terms
Node Types
Wow
Thank you so much, Adam
Just re-reading some of the documentation after reading your definitions has lifted 2/3 of the fog
I mean it--I've managed to get my theme mostly running, and I've almost completed writing a new module (now that I know what one is ) to set my site's home page up just the way I like it.
All that stands between me and a working initial site is a question about security (allowing some users to see some content and others not); but I'll ask that in the appropriate forum.
Really, a big thank you.
Gibby
Good work Adam
Nice explanation. appreciable effort. Keep going ..