Create page of blocks only / Create a node of blocks - drupal

Sometimes I use a basic page as a place holder for the purpose of creating a node to hold blocks.
So I create a basic page and link it to a menu, then I use the blocks interface to configure certain blocks to display on that page only.
The problem with this approach is twofold. Firstly I don't need the page, but secondly when a user tries to edit the page they're understandably surprised to find nothing.
Is there a better way of creating a node of blocks? Ideally, the more lightweight the better..
Thanks,

Hmm, this solution requires installing another module, but also provides other great functionality such as revisions.
http://drupal.org/project/nodeblock
You would also have to convert all of your old blocks into these new "Node Blocks"
Another option would be
http://drupal.org/project/empty_page

Related

Drupal 7: best way to render arbitrary content directly into <body> while keeping what's in <head>

I'm new to Drupal. As I understand a Drupal(7 in my case) page normally would have layers of wrappers around a block, sections, regions etc ... What I'm trying to achieve is to render some arbitrary content directly into "body" with none of the wrapper overheads, while keeping everything in "head". I've researched hook_block_list_alter which allows you to exclude blocks before rendering - which doesn't offer the ability to customize (removing) sections. Then I came across hook_page_alter looks like a good way to go, although I haven't dug too deep yet, still trying to understand the structure of the $page object. I thought about other options such as using the context module to configure sections/zones when requested page url is in certain pattern.
What's "THE Drupal's way" of doing this?
I would suggest you to first try with Drupal's template system and then, if you can't achieve something try with hooks:
https://www.drupal.org/node/337173
So, as you mentioned drupal has layer templates wrapping one around another. Most outer one is html.tpl.php and if you want something to appear in page head put it there. Then, second inner one is page template, which can be different for any content (node) type. But you also have block templates, field templates...
To override templates for specific content type or field or something else Drupal has some special naming convention. So if you name you template some specific way (and clear the cache!) drupal will start use it in that specific case.
Check the documentation for more details.

Drupal - Show content on specific page

Am I able to add the following field to a content type, so that each piece of content I create can be conditioned to a page?
Or is there a module to extend Publishing Options, where by it adds all the pages I have created (just like 'Promote to Front Page')?
If not, why is no one doing this? As a new user to Drupal this seems like it would be a handy operation. (I have already tried this module but it doesn't achieve the results I'm after).
If none of these solutions are available, what would be the best alternative way of doing this?
I've posted this question on Stack Exchange for Drupal but I need a quick answer and there seems to be a bigger community here :D
You should use Context. With Context, you'll be able to manage contextual conditions and reactions for your drupal like Regions.
Have you used Views? it is one of the most common used drupal modules. It doesn't extend publishing options directly but it does replace it in a way. You can say by example put a list of al content-types: your_own_Content_type that have the publishing options of promoted to front-page. then sort them by title, date, what ever you like.
you could also create only one view and create multiple blocks out of it. you have to understand the logic of drupal: if you want different blocks on different pages, you have to create the different pages AND different blocks
create the view for one type of content-type and make one block out of it. put this block on the desired page. All your other blocks are made with the same view, just adjust a condition in your view and create a new block out of it. You should also put all your blocks in the same region, and set the to the right pages
here you can find a lot of documentation if you run into any problems... drupal.org/project/views
Views is the best at creating a slideshow of images or any type of data on your site.
Used in combination with nodequeue it might offer near or the full functionality you are trying to achieve (check this out ... and this too) - but I don't understand your question entirely.
By my opinion Views is too complicated task for much simple request.
There is a few ideas for solution:
Easy way - You can create a specific template file or add some if statments to the node.tpl.php(specific tpl better)
For minor changes - Create a new context with "path" filter and "theme html" reaction, than hide the field by the css
Best but complicated(large usages) - create a new "view mode" and implement the display by new "hook_menu".
~ Almog

How to have a three column home page in Drupal

The home page of this site will have basically a 3 column layout.
I can create these as either content or blocks. I like using content because its easy for the user to understand, they login to the site, they browse to the page they want to edit, they click edit, but with blocks they have to go into Administer > Blocks etc
Any suggestions on this?
I would be managing the actual content as nodes(content) and then looking at blocks(or something like it) to arrange them how you like in your template regions.
If you are looking at creating custom home and/or landing pages, you might also want to look at http://drupal.org/project/panels - it can be a little heavy, but quite powerful for arranging content into columns and whatnot.
Not really sure what you're asking...
Administer > Blocks is for moving the blocks around into regions / disabling them, not really for creating content.
You can use the Node as Block module to easily turn your nodes into blocks, and they would still edit it from the content administration section.
Or, you could create a blank block, and in its associated template file (block-whatever.tpl.php) embed the node (node_embed, pretty much what the Node as Block module does) or query for it with a view and embed that (views_embed_view)
Or, if you're using views, you could create a view that queries for the node(s) you want and create a block display for that.
When you're actually building the Drupal site, you should consider what paradigm you're most comfortable with since there are so many ways to get your content together.
i would say boxes will help you. http://drupal.org/project/boxes
Many themes have block edit links/images as a part of them. Fusion is one such example.
I would suggest looking into Panels for layout and block editing, and also to download a version of open atrium. The layout management is uses is much easier than the administer blocks pattern.

Drupal views: Allowing users to choose sort criteria on node display

I have some nodes I am displaying in a view. They are displayed as nodes, unformatted. I would like the user to be able to choose from some predefined sort criteria ( via drop down list or similar).
So they could pick recently active, most commented, newest, etc., and re-query for new results.
Its easy with tables because you can make the labels clickable, but I do not know how to have similar functionality with a raw node preview display.
Just a thought, from me to me, and for anyone else who may be trying to do this.
An easy, sleezy option would be to just add another page view for each of the required sorts, and provide a link to these other views in the header of each of the pages.
This could also allow for (easier) linking to the individual sorts, so say if you have a sidebar block displaying recently commented nodes, you could adjust the .tpl.php of the block to have the title link to the view displaying the full set of recently commented nodes.
also im pretty sure there should be a way to do this with arguments, but i dont know how
Views 3 supports exposing sort order (just like you can expose filters)
Select the sort order (e.g. add sort by node creation date, then click on the settings for that), you should be able to expose the sort order to the end user. This is just like clicking on the settings for a filter and then choosing to expose it.
Standard views isn't going to support this, so IMO you're best off implementing a custom solution using just a plain old view and this jQuery plugin. You can either do this at the theme layer (the same way as any other JS in a theme) or a custom module (via drupal_add_js() to add the plugin and your bit of custom code). Either way will work, although the custom module has the obvious benefit of being theme independent (and thus more portable).
If you go the custom module route, please consider releasing it as a contrib module on http://drupal.org.

Drupal: create content in popup/lightbox?

In Drupal, is there a way to create new content (based on a content type that uses CCK) in a popup or lightbox or similar technique?
There are at least two worlds that I know of:
http://drupal.org/project/popups_reference which uses http://drupal.org/project/popups
and
http://drupal.org/project/noderelationships which uses http://drupal.org/project/modalframe
Both of these are about creating the node in a modal in order to reference it via a node reference field. There might be ones for more general purposes, or you could probably adapt one of those. I've been enjoying noderelationships lately. Haven't tried the other recently.
The projects sprugman refers to are useful when you need to create a referenced node while you're adding another node. If you simply want to make the /node/add/[contenttype] link to open in a lightbox, try the Lightbox2 module.
There is a great module in Drupal automodal that works with Modal Frame API. What you need to do is simply add a new class 'automodal' to your links... and the magic is done for you.
Another one is the Modal Nodereference module. Here is a quote about it (from the module's project page):
... turns the nodereference widget into a modal popup allowing new linked nodes to be created on the fly. Because it uses an iframe, it should support even Javscript and file uploads within the sub-node.
The big feature: It should work with editors, image fields, and all of those other JavaScripting things. We built it precisely to meet those needs. We started with modalframe, instead of one of the other popup libraries, because we knew that we could make this work with TinyMCE, CKEditor, and ImageField -- libraries that have difficulties dealing with other popup APIs.
It depends on the Automodal module, as well as the excellent Modal Frame API module.

Resources