One of the things that baffled me when I first started working with Drupal was how to get rid of the default blog style site and make the site look like a “Regular Web Site” with sections and sub-sections. I wanted the site to be more hierarchical for an organization with dynamic pieces of news, events and podcasts, sprinkled in here and there instead of just a most recent post on top site.This is part one of a multi-part stepThere are 3 or 4 steps to making this happen with (almost) no coding required. This is one of possibly many ways to accomplish this - it has worked well for me on small, and medium-sized site (not that it couldn't work on a high traffic site).
This is very straight forward. First make a nice shiny-looking home page. You can do this as a simple drupal page node or use perhaps Panels and Views modules to do something more sophisticated. Once you have your home page set to go, simply log in as an administrative user (or user 1) and go to Administer » Site configuration » Site Information and set the Default Home Page to the url or node id of this page.
2. Use taxonomy to categorize sections of your site
Set up a taxonomy vocabulary at Administer » Content management » Categories. You can call the vocabulary sections or something similar.
Create terms for each section of your site. Maybe you will have terms like Sales, Administration, and Customer Service. Perhaps you will have Admissions, Alumni, Administration, etc.... Make a note that you can see the taxonomy id (tid) by clicking list terms and mousing over the edit link for each term and you will see a link like:
/admin/content/taxonomy/edit/term/5?destination=admin%2Fcontent%2Ftaxonomy%2F1
The term id in this case is 5. You'll need this later. Tuck it away for safe keeping.
Now start creating your pages by going to create content >> page. Choose the appropriate term category for this page. So all the pages for the sales department get the taxonomy term “sales” for example.
3. Use the menu module to create menus for the home page and each sub section of the site
Navigate to Administer » Site building » Menus. Here you can create new menus and menu items. If you need a menu for you sales section of your site, click add menu, call it sales and start adding menu items underneath it. Notice each menu item has a weight value you can assign. If you leave this at 0 for all items, the menu will sort alphabetically. If you choose a weight for each menu item, they will sort - lowest value first. This allows you to make a custom sort order.
Make as many menus as you need for each section of your site.
4. Use Regions and Blocks powerful ability to make menus only show up on certain pages(nodes) and nodes in a specific category (taxonomy term)
Regions let us divide the page into blocks. The default blocks in a Drupal installation are top, bottom, left sidebar, right sidebar, and content (usually the middle). Blocks are short lists of node titles in most cases with links to the actual node themselves. When you make a menu in Drupal, a block for the menu is created for you automatically. Then you simply turn the block on by selecting the region it should show in as well as configuring which pages it should show on.
If node 10 is your home page. The menu that goes on the home page is configured to show only on node/10 . Easy! However, say you want to have all 35 of your sales pages. Not so easy! You don't want to have to list all 35 of the nodes in the block configuration setup. Fortunately you can add a php snippet here to make all the sales pages display the sales menu. Remember we told you how to find the term id for the sales category above. Let's say the sales category term id is 5. Under page visibility settings choose: Show if the following PHP code returns TRUE (PHP-mode, experts only). Here is the code to make this work:
<?php
$tid = 5; // sales
if (arg(0)=='node' && is_numeric(arg(1)) ) {
$nid = arg(1);
$terms = taxonomy_node_get_terms($nid);
foreach ($terms as $term) {
if ($term->tid == $tid) {
return true;
}
}
}
When You Are Engulfed in Flames
David Sedaris
Drupal 6 JavaScript and jQuery
Matt Butcher
Learning Drupal 6 Module Development
Matt Butcher
Front End Drupal: Designing, Theming, Scripting
Konstantin Käfer
Neuromancer (Sprawl Trilogy, #1)
William Gibson
No Code?
Hi, I am not seeing the code at the bottom of the page. Great info otherwise! Just need the code...
Thanks!
Brad
Teasing? ;)
You only want us to subscribe to your feed so we get to know when you update this post...
Well you got me :)
Sorry guys code is there now
mea culpa
creating your pages by going
creating your pages by going to create content >> page. Choose the appropriate term category for this page. So all the pages for the sales department get the taxonomy term “sales” Games Strategy Online Free
That's a good tip for my
That's a good tip for my free online games site. It should really help the quality of my puzzle games and my action games greatly. Thanks for the great tips.
good
Very nice article thank you very much...
Is there a way to delegate
Is there a way to delegate editing permissions to other people so that they can only add/edit pages under certain sections of the site. That is, if I have an "Admissions" section, can I allow someone in the Admissions department editing access to just that section?
The code is not working for
The code is not working for displaying the term. I am not sure why, but the block will display on all pages. Any ideas of what I am doing wrong?
If I have an "Admissions"
If I have an "Admissions" section, can I allow someone in the Admissions department editing access to just that section?
If I have an "Admissions"
If I have an "Admissions" section, can I allow someone in the Admissions department editing access to just that section? tower defense
You don't want to have to
You don't want to have to list all 35 of the nodes in the block configuration setup.