I have a drupal project with a hierarchical page structure. On each category page (top level), I'd like to have a blurb about the category, and then a series of links to subpages, where each link has a title, an image, and a sentence or two, laid out in a box.

I've looked into modules such as "Menu Node Views" and "Node Hierarchy" but I'm not certain that those are the best way to go about doing this. (Right now, as a temporary solution, I've just defined a bunch of blocks each containing an individual link/image/blurb and attached them to the overview pages using contexts).

Can someone suggest a good way to do this? Ideally it could be attached to the menu system in some way so that changes to the menu would be reflected in the appropriate overview page.

(See http://www.freethechildren.com/aboutus/index.php for an idea of the kind of navigation structure I want to display in the page content, although there will be actual content above the link blocks).


I would simply use content types (cck if you're in d6), views in blocks, taxonomy and some theming. I'm sure there are other ways to do it, but this would maybe be one.

Create a taxonomy 'category' and add all the 'categories' to it.

Create the content types category_page and category_sub_page (or something along those lines).

Create the fields you need for each content type: For the category_page add a taxonomy tag field (to add the category from your 'category' taxonomy vocab) and if you wish to have images as headers different on each cat page add an image field etc ..

For the sub_page you need 2 or 3 image fields (depending on how many different images you wish to show (1 on the teaser, 1 or 2 on the main page?) and another taxonomy field.

Create your category overview page - tag it. Create your subpages pages for that cat - tag them too.

Create a .tpl file for your node type: In d7, copy the node.tpl.php file in your theme/template/ directory twice and name them node--category_page.tpl.php and node--category_sub_page.tpl.php (that's if you used naming conventions like above).

Create a node view that displays node type = category_sub_page and filter them by category, so only display category = 'SOMETHING' - or go even further and use arguments to get tax term of page and show only subpages with the same term (this way you could only use 1 view for multiple category pages). Create a block view from that showing teasers, add it to the content reagion using the blocks page. It should be displayed below the actual page content - if you don't have a region there you will need to add a block region. You'll have to add it to your theme in the page.tpl.php and the theme.info file. Read up about it.

Now edit your theme files for sub_pages .. node--category_sub_page.tpl.php - start it with

<?php if (!$page): ?>

anything in between here will be shown as the teaser - that's you're menu block with text image - then

<?php endif; ?> 
<?php if ($page): ?>

now anything in between is your sub_page full view.

To help you add items use to display the different items called.

 <?php dsm($node); ?>

then add them with php, defining your layout and style classes. Now theme it using css to get your desired look

Now you've create a node that displays sub-nodes in a block below the content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.