вторник, 14 октября 2008 г.

front page in Drupal


After following the next few steps, you will be able to easily add / change your front page anytime in the future.

1. Creating your front page

After logging in as Administrator, select

Create content > Page

from the left menubar, and create your own content that you would like to publish as a front page. If you are done, hit „Submit” to see the results. Notice that the current URL (the path to your newly created page) looks like this

http://www.example.com/?q=node/# (normal)
http://www.example.com/node/# (using clean URLs)

where # means a number. We will need that number, so write that down somewhere or just try to remember that.

2. Front pages

Now you can either choose to

  • 2.1. Set a single page as your front page or
  • 2.2. Promote your page to the front page, this way adding it to the top of the front page posts. (Only the first 5-10 lines will be published there (as a preview), you will have to click on it to see the whole page).
  • 2.3. Use the Front module to fully customize your front pages (theming, different user roles...)

2.1. Setting your page as Front page

After creating your custom page, select

Administer > Site Configuration > Site Information

At the bottom of this page where it says „Default front page” you will have something like this

http://www.example.com/?q= (normal)
http://www.example.com/ (using clean URLs)

and an input field next to it. That is where you have to enter

node/#

where # is the node number that you previously wrote down. By pressing „Save configuration” your front page automatically becomes the previously created page. You can reset that any time you want, by entering only

node

into the input field. (That is the default value).

2.2. Promote your page as Front page

If you want to promote your page to the front page, you should go back to step 1. but now don't press "Submit", or edit your newly created page (navigate to this address)

http://www.example.com/?q=node/#/edit (normal)
http://www.example.com/node/#/edit (using clean URLs)

where # is the node number.
Either way, at the bottom you will find a drop down menu called „Publishing options”, there you will have to check the „Promoted to front page” checkbox and that’s it. Press „Submit”.

2.3. Front pages with Front Module

If you really need more control over your front page, you can use the Front module to

  1. Set a different theme to your front page
  2. Set different front pages depending on user roles (admin, anonymous, authenticated)
  3. Insert custom php snippets into the front page

You can find the Front module at: http://drupal.org/project/front
After installing the Front module, select

Administer > Site configuration > Advanced front page settings

There the drop down menus are pretty self-explaining. If you click on any of the „Front page for _user role_” you will find

  • Body: you can input text, html and even php snippets that you want to display
  • Select Type: you can set other user roles to have the same front page as this, have default or custom themes be applied to it, etc.
  • Redirect to: you can set a location where users should be redirected to

If you are satisfied with your settings, press „Save configuration” and you are done.