Missing something simple

caelon - March 28, 2008 - 02:37

I created the following short test module to understand how paths work. This code is installed in /sites/all/modules/scoreos. When I go www.url.com/scoreos/test or www.url.com/scoreos/?q=test or www.url.com/?q=scoreos/test, they all send me to a 404 page. I'm sure there's something simple I'm missing but I don't see it yet. Any ideas? Thanks in advance.

<?php
     
function scoreos_test_menu($may_cache) {
         
$items = array();
     
          if (
$may_cache) {
             
$items[] = array(
                 
'path' => 'scoreos/test',
                 
'title' => t('Test'),
                 
'callback' => 'scoreos_test_start_page',
                 
'access' => TRUE
             
);
          }
      
          return
$items;
      }
      
     
/**
       * Called when user goes to /?=test
       */
     
function scoreos_test_start_page() {
         
$output = t('This page contains our test.');

          return
$output;
      }
     
?>

Try this...

zeta ζ - March 28, 2008 - 02:45

You should be trying to implement hook_menu with hook as your module name, so try with;-

<?php
 
function scoreos_menu($may_cache) {
?>

___________________
It’s in the detaιls…

Thanks zeta

caelon - March 29, 2008 - 00:49

That was the hint I needed. ScoreOS is really a collection of modules, so it ended up being test_menu, but you got me there.

 
 

Drupal is a registered trademark of Dries Buytaert.