2

I need to create a custom page which content region can be nicely presented as a set of views blocks. I don't know whether it's possible. So the question is:

Is there any possible way to create an empty page with certain url , e.g. "mysite.org/news", and fill its 'content' variable with some blocks without writing a module and declaring the page with php and hooks? Just from the admin interface.

2

This sounds like you need the panels module. It is quite a complex module so you could check out this learning series from node one.

2

Seems like Panels would be good for this. You'd create a panels Page and then assign the relevant blocks.

1

I have a slightly different solution that I use. As Splatio pointed out, it is somewhat of a complex module, and for me, most of what I need to accomplish can be done without panels, which saves the extra overhead of an extra module.

So,

  1. Create your page something.com/mypage. Give it a title, but make sure the body is blank when you save it.

  2. Create your views blocks. Now that you have blocks, you can configure them to show up on any one page you want. Configure them to show up on something.com/mypage, and then put them in the Content regions.

  3. Voila, the page is created with any number of blocks you need, and, without the body having any content, the illusion is complete.

3a. I have also used this technique to give the block views some context by adding a short paragraph. "See the newest entries for each category today" or something.

  • Yes, due to I'm a kind if novice in Drupal, it seems to be the best solution without any extra modules. But how am I supposed to create a blank page? Writing a module? Or you just meant a node page like "Basic Article"? – DimG Aug 14 '12 at 12:24
  • Yes, exactly. Basic page, and give it a title. If you have Clean URLs enabled, then you can use the part of the url that comes after .com/my-title to configure the block. So, for the block, click 'Configure' and then at the bottom select 'only on the listed pages' then type in 'my-title' Remember that drupal always uses 'node/id (node/33 for example) for each page, and the 'my title' is just an alias. If you use the node/33 instead of my-title, then if you ever change the title, then you don't have to worry about ever reconfiguring the blocks for that page. Let me know if you have questions – blue928 Aug 14 '12 at 13:08
1

You could do this all in views without any futzing with templates or knowing node/### by creating a page display in addition to all your block displays. For example, if you created a view with a page display with a path of news, it would define www.yousite.com/news for you and populate your theme's content region with its output. If you then created, either in the same or any other view, block displays, they could then be added to the content region as well and would follow that first view's output.

1
 <?php
 /**
 * Implements hook_menu().
 */
function my_module_menu() {
  $items = array();
  $items['path/to/page'] = array(
    'title' => 'Title',
    'page callback' => 'my_module_empty',
    'access callback' => TRUE,
    'type' => MENU_SUGGESTED_ITEM,
  );
  return $items;
}

/**
 * An Empty Page callback's empty content.
 *
 * @return string $output
 */
function my_module_empty() {
  return '';
}
?>
0

Easy, clean, simple: use empty_page module.

.. and to place blocks you can use context instead of the drupal blocks interface.

0

I have a workaround for this.

Create a text field in your content type that only allows 1 letter value. Give it a value of "don't fill in this field, it's used to create the page"

In your view, set your format to show fields. In the fields section, add the newly created content type field and set it's CSS class to hidden (display none).

Set your filter criteria to Content: Type(your content type).

Then configure your blocks to only appear on that page.

Alternately (I don't know if this is just on mine or what) but your fields section can also have the field, Content: Page. This sets a new page for me as well. But the above works fine too.

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.