0

I have a (non drupal bound) table, that I need to display within my site.

It has information about "runs":

userID (drupal) - runID - name - distance - ... etc

I want to go to site/run/runID and display the data of that particular run.

I don't know if there is an easy way of doing it without having to create a custom module for it? I basically just need to $get the variables and display them from the database. My first concern is calling my php code when the file is loaded.

And if I need to create a module for it. How would I go about it?

Or perhaps I can use panels to put my custom code on a page and get the url variables? Or some other module I am not thinking about...

--Update

To get started I created this little module. Now just reading the url parameter runID that is behind it...

function epicrun_menu(){
 $items['epicrun'] = array(
 'page callback' => 'epicrun_my_page',
 'title' => 'Callback',
   'type' => MENU_CALLBACK,
 'access arguments' => array('access content'),
 );
 return $items;
}

* this code (noted in the callback above) creates the
 * contents of the "epicrun" page */

function epicrun_my_page(){
 return "<p>This is my epicrun demo page.</p>";
}

2 Answers 2

0

I would suggest looking into the Data module. I does pretty much everything (and more) what you're describing in your request.

0

Ok, creating a new module for that seems very easy:

function epicrun_menu(){
 $menuitems['run'] = array(
  'title' => 'Run data',
  'page callback' => 'epicrun_mymenu_page_callback',
  'page arguments' => array(0),
  'access callback' => TRUE,
  'type' => MENU_NORMAL_ITEM,
  );
 return $menuitems;
}

/**

* Implementation of hook_menu().

*/
function epicrun_mymenu_page_callback($firstparameter = '',) {

  $result = 'This page will display the run data of the run with ID '.$firstparameter;/*
   $result.='<br> The first parameter passed to the url is :<b>'.$firstparameter.'</b>';
   $result.='<br> The second parameter passed to the url is :<b>'.$secondparameter.'</b>';*/

  return $result;

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.