1

I was wondering what is the best way to promote nodes into a page (ie front page).

Drupal comes with its own "promote to front" option and we have other ways such as using Flags modules for this purpose as well, but I need two features that none of those cover.

One is that I only want for example 5 nodes be promoted at the same time, so if the client promote one more node, one of the previous nodes will automatically be removed from the list.

Also I'd like to be able to set the order (weight) of those promoted nodes too.

I have tried to use views and draggableviews for ordering the nodes which works great but can't figure out how to limit the number of promoted nodes?

Many thanks

  • In Views, you can set the number of values returned in the pager config by selecting 'Display a specified number of items'. Have you tried that set to 5? – Jimajamma Aug 21 '12 at 19:13
  • Yes, thank you, but I don't want any remaining promoted content left, I can limit the display to show onl5 5 but actually there are more than 5 nodes at the same time being promoted, I would like to prevent that – Luca Aug 22 '12 at 20:11
  • gotcha. I figured if you said something like 'the top 5 in the draggable views list will be displayed' in the help/description that would do it for your users, plus they could then bring back stuff if they wanted without having to go out and reflag it. to automatically unflag content, you could hook into hook_flag() and unflag the oldest or something with some custom php code. drupal.org/node/305086 talks all about that kinda stuff. – Jimajamma Aug 22 '12 at 21:44
  • Thank you very much, I will be able to accept this answer if you move your comment to the section below, in order to appreciate your help. – Luca Aug 24 '12 at 18:09
  • glad I could help out! – Jimajamma Aug 26 '12 at 5:39
0

In Views, you can set the number of values returned in the pager config by selecting 'Display a specified number of items'. Have you tried that set to 5?

If you said something like 'the top 5 in the draggable views list will be displayed' in the help/description that would do it for your users, plus they could then bring back stuff if they wanted without having to go out and reflag it. to automatically unflag content, you could hook into hook_flag() and unflag the oldest or something with some custom php code.

Check out The Flag PHP API, which talks all about that kinda stuff.

0

Sounds like a perfect example for when you should use nodequeue.

With nodequeue, you maintain an ordered list of items in the queue, and items can be promoted at either the top of the bottom of the queue. There is also an administration page for every queue in which administrators can re-order the items in the queue at any time. There also is excellent views integration.

You may choose to have the queue with the size of 10 for example, and using views only display the top 5. This gives your content authors the ability to re-order items they want to show on the homepage, including ones that recently fell off.

The flag module has no concept of 'weight' and would only make sense to use if the order can be determined programmatically (e.g. by most recent first).

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.