Hey Everyone,
I am currently in the process of launching a new e-zine which will be located at http://citrikacid.com. I am going to be using Drupal as my CMS, and so far have been impressed.
For the last 24 hours I have been working away trying to theme Drupal. So far I have done a pretty good job (I think) but I am stuck! I have tried searching for the answer to this, but I can only read so much, so I apologize if this is posted somewhere else.
I am using phptemplate to theme the site. I have been able to get the basic layout operational, but I am not sure how to edit the actual content of drupal. In all the template files (node.tpl.php and others) the content of the page is called with the following:
<?php print $content ?>
But how do I go about editing that specific content? Things like the create content page display content options, but cluster them all together without proper spacing. The account pages display everything in a giant list, and things like the comment fields seem so big to me that I would like to edit the HTML to shrink them down.
Anyways, maybe there is a simple solution to this that I have overlooked... but how do I edit the content?
Comments
Theme individual components
Drupal is modular and hence does not work with a set of pre-defined templates. Content is output through themable functions which theme pieces of the page.
See the PHPTemplate documentation for more info.
--
If you have a problem, please search before posting a question.
I have read through the
I have read through the PHPTemplate documentation many times, but I still can't figure this out. While the document is helpful, it is not very detailed or specific.
I understand that Drupal is modular, and that the content is output through functions, but where does one go about to edit these functions? Is there a specific file which contains elements? or do I have to manually go through the hundreds of lines of code in each module to edit the content?
Theme function overrides
Look at http://drupal.org/node/11811. Then you can use the list of themable functions at http://drupaldocs.org/api/4.6/group/themeable to find the proper function to override. What I did was copy the basic function as written into my template.php, and then change it as needed.
Best,
Matthew
Have a great day™
Thanks Matthew, I will try
Thanks Matthew, I will try this also.
It can be tricky to control
It can be tricky to control the display of things within $content. But often it is possible. There are several ways it can be done and some are a lot more complicated than others. You might even be surprised how much you can control with just css.
The problem is, depending on which page you are on, $content can be generated from many countless places so there isn't really a silver bullet answer.
You're going to have much more success getting an answer here if you can limit your question to something more specific. For example:
Instead of asking...
Try something like this...
In which case someone might tell you to add the following rule to your stylesheet:
You might find that you can apply this same solution toward many of your other questions. When you come up against something new that you can't figure out, ask about that specific thing and we can help you solve that issue too.
I hope my answer makes sense and doesn't sound condescending. I realize Drupal, and phptemplate can be really frustrating.
: z
This wasn't condescending at
This wasn't condescending at all :) Infact you answered my question very well, thank you.
I would have to gather the specifics...but if many of these things can truly be edited through CSS then I guess I will just try and look at the source code to see what each element is defined as.
There was a little hoping that there was a central file(s) that I could edit, but as long as there is a way to fix my issues I am happy.
Thanks,
John
web developer toolbar
If you are going to do this, you simply must get the web developer toolbar for FireFox
http://chrispederick.com/work/firefox/webdeveloper/
Brief article on how to use part of it
http://www.alistapart.com/articles/printyourway/
-sp
---------
Test site...always start with a test site.
Drupal Best Practices Guide
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide