Listing Nodes on a Node View
I've created an agenda.module which associates agenda nodes with event nodes. I wish to list all agenda nodes associated with a particular event when I view the event. I've come up with code in hook_nodeapi that I *thought* would do this, but it isn't. Can anyone help? Thanks. <?php function agenda_nodeapi($node, $op, $arg = 0) { global $form_values; switch ($op) { case 'view': // If the user has the view agenda perm and this node is agenda enabled // display the agenda list. if (user_access('view agenda') && agenda_type_is_enabled($node->type)) { $output = agenda_list($node->nid); // This gets a themed table. // Save output into a node property for retrieval from the theme layer. $node->agenda_view = $output; // Store the data directly into the content array, for default display. $node->content['agenda'] = array( '#value' => $output, '#weight' => 15, ); } break; ?> I'm not sure about my use of $node->agenda_view and $node->content['agenda'] as I basically copied that code from another module (signup) which lists items in the event node view in the format I wish. Thanks! -ron -- Ron Parker Software Creations http://www.scbbs.com Self-Administration Web Site http://saw.scbbs.com SDSS Subscription Mgmt Service http://sdss.scbbs.com Central Ave Dance Ensemble http://www.centralavedance.com R & B Salsa http://www.randbsalsa.com
Ron Parker wrote:
I've created an agenda.module which associates agenda nodes with event nodes. I wish to list all agenda nodes associated with a particular event when I view the event. I've come up with code in hook_nodeapi that I *thought* would do this, but it isn't. Can anyone help? Thanks.
Listing nodes is a great place to use the views module to construct and display a default view and add it to the content of the node. You also don't need to store the item twice afaik because you can still access the "content" array in the theme for custom theming. Unless you have a heavier module modifying it. Assuming agenda_list() returns output, this otherwise looks functional. If you are duplicating "views" functionality though i might suggest just calling on that module to do the job. -- Michael Favia michael@favias.org tel. 512.585.5650 http://michael.favias.org
participants (2)
-
Michael Favia -
Ron Parker