I am still not quite getting a few things in drupal development. Here is a piece of code I am writing:

while ($points = db_fetch_object($result)) {
$rows[] = array(t($points->name),
t($points->tot_points),
t($points->tot_games),
t($points->avg_points),
l(t('details'), "poker/details_page", array())
);
}

The code in question is the link. I just want to create a function called details and have it run a query that displays some info. So the problem is, what should the path name to a function be (the poker/details_page) and what should the function be called?

I was trying to call the function details_page in the poker module and have tried numerous different ways of referencing it, but I can;t get t to work. Any help would be greatly appreciated.

Norm

Comments

nevets’s picture

The menu hook allows you to associate paths with a callback function. Though often used to add to menus, by using a type of MENU_CALLBACK you can have association without a menu entry.
Something like the following should work

<?php
function poker_menu($may_cache) {
  $items = array();

  if ($may_cache) {
    $items[] = array('path' => 'poker/details_page', 'title' => t('Poker Details'),
      'callback' => 'poker_detail_page',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK);
  }
  return $items;
} 

function poker_detail_page() {
  // Function called when the path poker/details_page is used
}
?>

And to make a link to the page you could use something like

<?php
$link = l(t('details'), 'poker/details_page');
?>
npollock’s picture

Ok, I have it working and see how that works now. Thank you very much for your help! Using that info, I should be able to create a return button to return back to the previuos page now also.

Thanks again.

Norm