Create Next/Previous node links in a node-panel in Drupal? - drupal

So I am on a seemingly simple mission of creating previous/next buttons for a type of nodes, like for pages in a book. Sounds easy enough, considering that there is the Custom Pager module. But, the module does not work for nodes which are built using panels, as described in this bug: http://drupal.org/node/591782
There is another module which creates an API for this operation, but it does not seem to have custom sorting based on a view.
Any ideas would be highly appreciated and thank you in advance.

What about using the views module (and its built-in pager functionality) to display a single node at a time?

In the end I used the code described in the bottom of this page, but had to modify it a little to sort by date:
http://drupal.org/node/37767
Then put it into a custom content pane using (note that I rearranged the variable order):
print node_sibling(node_load(arg(1)), 'previous')
print node_sibling(node_load(arg(1)), 'next')

Related

Create page of blocks only / Create a node of blocks

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

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

Drupal : how to create a view that displays all the content-types

It may sound 'weird' but I need to have a view that lists all the content types I have.
For example i have two content types : contenttypeA, contenttypeB
I want to create a view that just displays the two content types (and show number of items of that type, but that can be done later).
For now what I did is add one content of each content type and list them but only show the 'node type'; it works well if there's at least one content but I want to display even without any content of that content type.
Any idea ?
Introducing the node_type table to Views requires a custom module and some Views API knowledge however http://drupal.org/node/1001222 will give you a head start.
Use a Customfield: PHP code field and custom code the whole thing with PHP. This is provided by the Views Custom Field module.
Use the Table Wizard module to make the node_type table available to views. You may need to use the Data module as well since they say that all future development is going there.
Expose the node_type table yourself by writing a custom module using the Views API as suggested by chx.
Number one is the quick and dirty way, but number 2 might be a little more manageable, but I am not completely sure it will do everything you want. If you do number 3 make sure you contribute back to the community by putting your module on drupal.org.
There is no native functionality in Views to do that. You can write a static page or (overkill) a module that provide a "system"-like type similar to Views Watchdog.

Drupal: how to add pdf links to a block?

I've some blocks in my Drupal website with some text.
I need to other some links in the text, to pdfs (and upload them from back-end).
Can I add some upload fields to the block pages, and link them from the text ?
thanks
Check out the Insert module, which allows you to upload files to a FileField and then easily link to them from within the node body.
I usually just end up attaching them to a node and then linking them manually. Not the answer you were probably looking for, but it works.
If you have views module available you can create a view that lists the pdfs attached to a particular node, using the node id (nid) as an argument, or use more complicated arguments if you want, as long as the fields displayed in the view are the the filefields you used for your pdf you can get pretty creative with how the pdfs are organized.
It's somewhat tricky to get arguments into views blocks but it's certainly possible, using panels, or using other tricks. More info on that:
here: http://drupal.org/node/150482
here: http://drupal.org/node/695124
http://drupal.org/node/161867#comment-1086587
Might not actually help you, but the D7 version of http://drupal.org/project/block_api creates fieldable blocks, which means that you can attach any type of fields to created blocks.
For D6, the solution is more complex I guess. You could create a separate content type, attach the files there (by using Inline, FileField, ...). Then, either write a custom module that exposes a block for each node of that type and then renders the node in those blocks or use Views to create a view of a single node. Using views would be a bit overkill I guess but should be relatively fast if you can use caching..

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.

Resources