README.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. The Node Queue module allows an administrator to arbitrarily put nodes in a
  2. group for some purpose; examples of this might be to highlight one particular
  3. node, as in a typical news site's Lead Article. Another use might be to create
  4. a block listing teasers for 5 forum posts that the admin thinks are important.
  5. Another use might be to create a group of nodes, and then have a block or the
  6. front page offer one of these randomly.
  7. Queues can be set to allow only certain types of nodes to be added to the
  8. queue. Queue can be a fixed size or of infinite length. And the admin can
  9. select which roles have permission to add nodes to a given queue.
  10. Once a queue is set up, a new tab will appear on eligible nodes for eligible
  11. users. This tab will allow the user--regardless of edit permissions--to add or
  12. remove that node from the queue. Queue admins can view the nodes in the queue,
  13. and can modify the order of items already in the queue. Items may also appear
  14. in a nodes links area to add/remove them from the queue.
  15. When a node is added to the queue, it is added to the back of the queue. If a
  16. queue is full when a node is added, the front of the queue is removed.
  17. Nodequeue has support for nodes with i18n Internationalizations.
  18. It is highly recommended that you use the Views module to display your queues.
  19. However, if you choose not to, here is an alternative: Writing a PHP snippet.
  20. To Create a Block to Display Node Titles of a Queue
  21. ===================================================
  22. You'll need the Queue ID, which is easily extracted from the URL on the
  23. queue administration page.
  24. Create a new block, and insert the following PHP snippet into the block:
  25. <?php print nodequeue_node_titles(QUEUEID); ?>
  26. If you want this queue to be printed in the reverse order, you can tell it
  27. to print backward:
  28. <?php print nodequeue_node_titles(QUEUEID, '', true); ?>
  29. The '' in the line above is an optional title field. Feel free to put
  30. something here, but it's not terribly necessary in a block.
  31. Programatically displaying nodes from a Queue
  32. ===================================================
  33. The following funcitons can be used to display nodes from a subqueue, based on their position.
  34. For more customized displays of content from a queue, please use the Views module (http://drupal.org/project/views).
  35. For the most up to date Nodequeue API information, see http://drupal.org/node/293117.
  36. Programmatic Ways of Displaying Content from a Queue
  37. Nodequeue provides several functions which simplify getting a loaded node object from the front, back or a random position in a queue. For more selecting or displaying content in a more specific or complicated way, the Views module is probably your best bet.
  38. Please note that there are some differences between the functions available in the 5.x-2.x and 6.x.-2.x versions of Nodequeue.
  39. To Create a Block to Display Node Titles of a Queue
  40. You'll need the Queue ID, which is easily extracted from the URL on the queue administration page.
  41. Create a new block, and insert the following PHP snippet into the block:
  42. <?php
  43. print nodequeue_node_titles($subqueue_id);
  44. ?>
  45. If you want this queue to be printed in the reverse order, you can tell it to print backward:
  46. <?php
  47. print nodequeue_node_titles($subqueue_id, '', TRUE);
  48. ?>
  49. The '' in the line above is an optional title field. Feel free to put something here, but it's not terribly necessary in a block.
  50. To Display a list of teasers from a queue:
  51. Like above, you'll need the Queue ID.
  52. Create a new page (or a new dashboard!) or any node type you like, really, and set the input filter to PHP. Insert the following PHP snippet:
  53. With Nodequeue 6.x-2.x:
  54. <?php
  55. print nodequeue_view_nodes($subqueue_id);
  56. ?>
  57. With Nodequeue 5.x-2.x
  58. <?php
  59. print nodequeue_nodes($subqueue_id);
  60. ?>
  61. There are a few more options available here; changing the order of the nodes, whether or not to use teasers or full nodes, whether or not to display the links, and how much of the queue to display. See below.
  62. To render the first or last node from a queue
  63. With Nodequeue 6.x-2.x:
  64. <?php
  65. $node = nodequeue_load_front($subqueue_id);
  66. $rendered_node = node_view($node);
  67. ?>
  68. With Nodequeue 5.x-2.x:
  69. <?php
  70. $rendered_node = nodequeue_fetch_front($subqueue_id);
  71. ?>
  72. Or
  73. With Nodequeue 6.x-2.x:
  74. <?php
  75. $node = nodequeue_load_back($subqueue_id);
  76. $rendered_node = node_view($node);
  77. ?>
  78. With Nodequeue 5.x-2.x:
  79. <?php
  80. $rendered_node = nodequeue_fetch_back($subqueue_id);
  81. ?>
  82. To render a random node from a queue
  83. With Nodequeue 6.x-2.x:
  84. <?php
  85. $node = nodequeue_load_random_node($subqueue_id);
  86. $rendered_node = node_view($node);
  87. ?>
  88. With Nodequeue 5.x-2.x:
  89. <?php
  90. $rendered_node = nodequeue_fetch_random($subqueue_id);
  91. ?>
  92. Remember that the front of the queue will have the least recently added nodes (unless it was rearranged manually), and the back will have the most recently added.
  93. Actions Module Integration
  94. ==========================
  95. The node queue module provides two actions, so that workflow can add and
  96. remove items from queues.