Re: [development] Listing Nodes in a Node View
I've almost got this working. Utilizing code contributed in the module development forum, I have verified that my $output is correct. I have a screen shot here: http://www.scbbs.com/node/307 In agenda_nodeapi, this one line doesn't appear to work: $node->content['agenda'] = array( '#value' => $output, '#weight' => 15, ); I'm defining the field "agenda" here. This is not defined or set up anywhere but here. Is this how it's supposed to work? If so, what could I possibly be doing wrong here? The entire code: 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. drupal_set_message("agenda_nodeapi: output is $output"); // I'm seeing this, so correct output is calculated // Store the data directly into the content array, for default display. $node->content['agenda'] = array( '#value' => $output, '#weight' => 15, ); } break; 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
On Tuesday, 18. December 2007, Ron Parker wrote:
The entire code:
function agenda_nodeapi($node, $op, $arg = 0) { (...)
When you don't take $node as reference parameter, you'll have a hard time changing it. Better copy hook_nodeapi() function signatures from official places like http://api.drupal.org/?q=api/function/hook_nodeapi/5 . Have fun, Jakob
Thank you. Thank you. Thank you. Using the correct function signature made all the difference in the world: function agenda_nodeapi <http://api.drupal.org/api/function/hook_nodeapi/5>(&$node, $op, $a3 = NULL, $a4 = NULL) { -ron Jakob Petsovits wrote:
On Tuesday, 18. December 2007, Ron Parker wrote:
The entire code:
function agenda_nodeapi($node, $op, $arg = 0) {
(...)
When you don't take $node as reference parameter, you'll have a hard time changing it. Better copy hook_nodeapi() function signatures from official places like http://api.drupal.org/?q=api/function/hook_nodeapi/5 .
Have fun, Jakob
__________ NOD32 2731 (20071218) Information __________
This message was checked by NOD32 antivirus system. http://www.eset.com
-- 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
participants (2)
-
Jakob Petsovits -
Ron Parker