Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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).

like image 673
Flávio Amieiro Avatar asked Aug 29 '08 21:08

Flávio Amieiro


2 Answers

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.

like image 200
Daniel James Avatar answered Sep 28 '22 11:09

Daniel James


The main css file that drives your content is the styles.css file located in your currently selected theme. In your case that means that most of your site styling is driven by this file: /aroda/roda/themes/garland/style.css with basic coloring effects handled by this file: /aroda/roda/files/color/garland-d3985506/style.css

You're currently using Garland, the default Drupal theme included with the core download, so for best practices you shouldn't edit the included style.css file directly. Instead, you should, as Daniel James said, create a subdirectory in /sites/all called "themes".

If you're using Drupal 6, I'd follow Daniel James directions from there. If you're using Drupal 5, I'd go ahead and copy the garland directory into the themes directory and rename it for something specific to your site (aroda_v1) so you would have something like /sites/all/themes/aroda_v1 which would contain styles.css. At that point, you can edit the styles.css file directly to make any changes you see fit. Hope that helps!

like image 26
William OConnor - csevb10 Avatar answered Sep 28 '22 11:09

William OConnor - csevb10