1

I've built all my site apart from the frontpage which right now shows:

No front page content has been created yet.

The frontpage will be the most complex page of all, containing a lot of boxes (blocks) which will be presenting lists of items.

I've got 2 solutions for this problem and I'd like to know which one is best.

solution 1 - blocks

  • create the ~10 blocks that the frontpage needs
  • make them translatable
  • use description prefix "front -" for easier identification in admin/structure/block
  • configure "Only the listed pages": <front>
  • somehow remove the "No front page content has been created yet" message

This solution seems very tunable. The CM will be able to do whatever he wants with the individual view blocks of the frontpage. On the other hand there will be too many blocks in the administration page (but only 1 for all languages).

solution 2 - node

  • create a node
  • the node should be of a type which has fields for configuring the fetching and displaying of items. e.g fields:
    • int: number of news to fetch
    • int: number of events to fetch
    • bool: should display teaser
    • html: teaser content
    • etc
  • in admin/config/system/site-information set that node as Default frontpage

The drawback of this is that I should implement the fetching and display, and if the CM wants to change something that the content type does not support I'll need to implement it. On the other hand I'll have full flexibility in HTML if I provide a separate template just for this content type.

So, is there a definite winner between those 2? Also note that, for various reasons, I don't want to use panels.

  • 5
    This is like the PERFECT use case for Panels - I'm not sure why you wouldn't want to use it. But if you are REALLY set in your ways, then go with the blocks. I'm not going to put this as an answer yet as someone else might be able to give you other ideas/suggestions. – Chapabu Jun 22 '12 at 8:24
  • @Chapabu: Feel free to add it as an answer. – cherouvim Jun 28 '12 at 8:35
5

I know you said you didn't want to use it, but this is a PERFECT use case for Panels. I'm not a huge Panels user and will generally steer clear of it if I can, but sometimes you have to step outside of your comfort zone and just use the best tool for the job.

There's a video here that focuses on using Views and Panels for a home page layout.

In this Drupal video tutorial we take a brief look at panels. I show you how to recreate a home page that relies on views content panes. As a result, we create a two column home page panel which pulls in recent content from across all content types and shows which users are online.

But if you are REALLY set in your ways, then go with the blocks. You can always put the blocks into Panels at a later date.

2

I have done this with blocks before, you can create a template file called page--front.tpl.php and do whatever you want there. Then make use of functions like views_embed_view to embed a view:

<?php print views_embed_view('case_studies','block_1'); ?>

Or use a block:

<?php print module_invoke('search', 'block_view', 'search'); ?>

My current project has a dynamic page calling all sorts of content elements and I am doing it with panels this time, consider using it.

  • Thanks. Have used blocks and will consider panels in the future if the frontpage becomes more complex. – cherouvim Jun 28 '12 at 8:34
  • I can confirm now that panels is awesome, a bit fiddly and I am sure there is a lot more I could do with it. – Duncanmoo Jun 28 '12 at 9:29

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.