How can I change the way my Drupal theme displays the front page

Flávio Amieiro picture Flávio Amieiro · Aug 29, 2008 · Viewed 9.4k times · Source

I am trying to build an website for my college's magazine. I used the "views" module to show a block of static content I created on the front page.

My question is: how can I edit the theme's css so it changes the way that block of static content is displayed?

For reference, here's the link to the site (in portuguese, and with almost zero content for now).

Answer

Daniel James picture Daniel James · Aug 31, 2008

I can't access your site at the moment, so I'm basing this on fairly limited information. But if the home page is static content, the views module might not be appropriate. It might be better to create a page (In the menu, go to: Create content > page), make a note of the page's url, and then change the default home page to that url (Administer > Site Configuration > Site information, 'Default front page' is at the bottom). Although I might be misunderstanding what you mean by 'static content'.

But however you're creating the front page, don't edit the css in the theme - it'll get overwritten next time you upgrade. Instead you need to create a sub-theme.

As an example, if you want to subtheme Garland, in drupal 6. You first need to setup a directory for your themes. Go to sites/all/ in your drupal installation, and create a subdirectory called themes if it doesn't already exist. Go into that directory, and create a directory for your subtheme, say mytheme (i.e. sites/all/themes/mytheme/). Then use your text editor to create a file called mytheme.info in that directory, with the contents:

name = My Theme
version = 0.1
core = 6.x
base theme = garland
stylesheets[all][] = mytheme.css

And then use your text editor to create a file called mytheme.css in that directory, and put the extra CSS in there.

For more information, there's the druapl documentation on .info files and style sheets. Although, you might want to buy a book, as the online documentation isn't great.