Posted by mansoor.k on April 21, 2009 at 8:20am
Hi,
I want to make a theme that can display the same front page theme layout for some categories/links .
For instance the site will have News categories like local, national, international, business,etc. Each menu link to these should display the same home front page format. And news promoted to front page to these categories should move to the corresponding front pages.
Any ideas, inputs to achieve this will be highly appreciated.
Thanks a lot.
Mansoor
Comments
Taxonomy Theme?
I'm not entirely sure what you mean, but you might want to look into taxonomy theme. It's a module that lets you change your themes based on taxonomic terms in your url.
panels
You could also work with a panel page that accepts an argument that it passes on to its Views. If this sounds like chinese, check out the docs to the Views module or just play around with arguments in the interface where you construct a view, and then do the same for the Panels module :-)
Multiple front pages with custom templates tied to content type
Here's one way of doing this:
1. Create a content type called "home-container". Don't add any additional fields. For this purpose, you'll only need the Title field. You'll be using this only as a "container" for blocks with Views content. See Bob's excellent video at: http://mustardseedmedia.com/podcast/episode11
2. Use the "home-container" content type to create a page for every "sub-home" page. In your example, create a separate page named "local", "national", "international" etc.
3. Create a menu link to each of these nodes. i.e. create a menu link to "local", "national" etc.
4. Create a custom template for these "home-container" landing pages. Include only the region variables that you need. I use a 960.gs style template and have a regions called $maincontent1, $maincontent2, and $maincontent3. These represent three columns similar to sites like www.wsj.com and other news sites. I then populate those regions with View blocks.
5. Now the interesting part: You need to modify your template.php file to associate a custom template with a specific content type.
Here's the code. (I got this from some brilliant Drupal coder on Drupal.org post - maybe someone else can find the reference.)
// Allow use of specific template for specific content type:
function phptemplate_preprocess_page(&$variables) {
if ($node = menu_get_object()) {
$variables['node'] = $node;
$suggestions = array();
$template_filename = 'page';
$template_filename = $template_filename . '-' . $variables['node']->type;
$suggestions[] = $template_filename;
$variables['template_files'] = $suggestions;
}
}
6. Finally, create views (blocks) for your "sub-home" content and place them in your regions.
7. To filter and display specific content on each "sub-home" page, you can use a combination of methods including View filters, nodequeue etc. A robust, well-thought-out taxonomy is key.
Multiple front pages with custom templates tied to content type
Thanks a lot for the input !!!
I plan to build it based on vocabulary id and custom template.
Instead of views I wish to use optimized SQL using cache inside the template files . I am still researching how I can achieve this, any ideas will be appreciated.
Thanks,
mmk