I really like the addition of taxonomy for listing nodes! Thanks; this is going to help me finish my site! I am simply wondering how I might make a node or page that would always list the nodes from a particular taxonomy. Is there a way to call the node-list module in a snippet of code inserted into the body of a node (I'm guessing that my own ignorance is working against me here)?
Thank you for any suggestions.
Comments
Comment #1
baudolino commentedWhy would you need a separate page, when you can list the taxonomy by navigating to taxonomy/term/[tid]/list? You can easily create URL aliases for all these listings and then create menu entries that point to the aliases. Wouldn't this solve your problem?
Comment #2
njivy commentedBaudolino has a good point, but there may be circumstances where multiple per-taxonomy node lists must be rendered on the same page. This is almost possible with the current version of the module, and it's an easy fix to support this.
I will update the module soon, and then you can call
nodelist_render($type, $id)from any page or block. But first, I need to figure out how to handle the index links at the top of the page.Comment #3
njivy commentedUpdated.
Comment #4
bomarmonk commentedHere's an example of why I would want a node-list embedded in a page, instead of calling it with a URL or menu: I am using books to organize the hierarchal structure of my website (according to local government departments), and within each department there are files/documents that are associated with that department and classified as such within the taxonomy system. So, it would be advantageous to list all node of the type "file" according to the departments taxonomy and also have this appear within the department's book navigation as a "files" or documents page. My book navigation block would then look something like this:
The first page, "About," is the parent/root page, the second page (Agendas...) is a list of "file" nodes with the taxonomy term of "agendas," and the third page is a contact form created with the webform module.
If it is possible to use two taxonomy terms to list nodes, the task of creating these pages become even simpler and far more useful. For instance, I want to classify "Agendas" and "Minutes" seperately, but in this case, have both of them appear on the same "node-list" page according to the department category term, "board" (with seperate headings according to the terms, "Agendas" and "Minutes"-- this can be hardcoded into the node along with two seperate calls to the nodelist module for each taxonomy term-- but I'll also need to call the parent term "board" in order to grab the correct department's file nodes).
Elsewhere on my site, however, I would like the node list to be of only "agendas" and "minutes" for the planning department (etc.)-- on the planning dept. agendas and minutes book page.
I hope this clarifies the usefulness of the added functionality. I'm not sure how many Drupal users would benefit, but it would seem that this module will greatly expand the flexiblity of Drupal in terms of content presentation--- and this could even attract more users and therefore more contributors? The added functionality seems particularly useful for organizational sites with a specific hierarchy and structure for most content.
Comment #5
bomarmonk commentedAny idea how to use nodelist_render($taxonomy, $10) to embed a nodelist into a book page? Do I need to write a custom php script that uses this function? Thanks for any help!
Comment #6
njivy commentedYour syntax is almost correct, bomarmonk. But you are passing variables named taxonomy and 10 when you should be passing values. So take the dollar signs off and wrap the values in single quotes.
node_render('taxonomy', 10);Actually, numbers don't need to be wrapped in quotes. But in PHP, it doesn't usually matter either way.
Comment #7
bomarmonk commentedI'm still having trouble with this... I'm illiterate when it comes to PHP:
Is that it? I'm getting an error message with this code. The error:
Fatal error: Call to undefined function: node_render() in /home/WWW/drupal/includes/common.inc(1841) : eval()'d code on line 2
I'm sure I'm being a bit simple... does there need to be a print statement? An $output?
Comment #8
bomarmonk commentedOops--- it should be:
But this still doesn't work, even with the right type of node selected in node.list settings and content posted and published under term 10. Nothing shows up (although there aren't any errors either).
Comment #9
njivy commentedYes, I spoke incorrectly -- the function is called
nodelist_render().I suspect that you see no results because no results are printed to the screen. Try
print nodelist_render('taxonomy', 10);. The nodelist function returns information which is then passed to the printing function.Comment #10
bomarmonk commentedYes, that did the trick. Thank you for answering and tolerating a question for remedial programming!
Comment #11
heather commentedi want to do the same thing. i'm a bit lost. i get an error: "Fatal error: Call to undefined function: nodelist_render()" (using Drupal 4.6.3)
and i can't find references to this function, nodelist_render, in the drupaldocs.org
i tried to implement this by creating a page, and putting....
in the body input text field, and ticking 'PHP' as filter type.
this generated the error above. how was this meant to be used?
Comment #12
njivy commentedThat looks right to me. Is the module enabled? Do you have the latest version of the module?
Comment #13
heather commentedah.. enabling. yes. right. that helps! (sorry!)
Comment #14
wmostrey commentedIssue resolved, feature added by njivy.