views:

32

answers:

1

I've defined a custom content type - news. I also have a menu item - latest news - that links to one of the news nodes. I want it to link to the latest of them. How would I do that?

+1  A: 

Common end user approach: Using the Views module, you create a view page (with its own path) that only shows the latest (or n latest) node(s). Then you point your menu item to that page.


Alternate developer approach: If you want to avoid the overhead of the views module, you could also implement hook_menu() within a custom module. There you'd register a custom callback function for a new path (e.g. '/show/latest/news'). The callback function would then determine the latest news node and either render it itself, or redirect to its path using drupal_goto(). Your menu item would point to the new path.

Henrik Opel