How to link to a function?

hi, I am developing a module but I am having a problem linking to another function. I know about the hook_menu but I would like to know how I can link to another function using the

Any help would be greatly appreciated :)

Adding a 'more' link and showing all entries

We now have a function that creates a page with all the content created a week ago. Let's link to it from the block with a "more" link.

Add these lines just before that $block['subject'] line in function onthisdate_block(). These lines will add the more link to the end of the $block_content variable before returning it to the block module:

Letting Drupal know about the new function

Main topic described: Using Drupal Menu system
Drupal hook described: hook_menu

We've just created a function that will generate a page with links to the content created on a particular day. If we want anyone to see that page, the next thing we have to do is to assign it a URL, via Drupal's hook_menu(). We have already used hook_menu to define the URL for the settings page, so we'll just need to add another entry to that function:


function onthisdate_menu() {

  $items = array();

  //this was created earlier in tutorial 7.
  $items['admin/settings/onthisdate'] = array(
    'title' => 'On this date module settings',
    'description' => 'Description of your On this date settings page',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('onthisdate_admin'),
    'access arguments' => array('access administration pages'),
    'type' => MENU_NORMAL_ITEM,
   );

  //this is added for this current tutorial.
  $items['onthisdate'] = array(
    'title' => 'On this date',
    'page callback' => 'onthisdate_all',
    'access arguments' => array('access onthisdate content'),
    'type' => MENU_CALLBACK
  );

  return $items;
}

A few notes:

Event modules

Contains information about the minimum set of information needed to make a viable event system, and information current to Drupal 6.x about certain modules which may be of assistance in building practical implementations of event systems.

Generating page content

Main topic described: Displaying content

So far we have our working block and a settings page. The block displays a maximum number of links. However, there may be more links than the maximum we show. So, let's create a page that lists all the content that was created a week ago. This is a three-step process, which we'll describe on this tutorial page and the next two pages.

The first step, described on this page, is to add a new function to our onthisdate.module file that will output a complete list of all the content that was created a week ago. We'll name this function onthisdate_all() (we could choose another name, but it must start with "onthisdate_").

Creating a module configuration (settings) page

Main topic described: Drupal 6 Module settings
Drupal hook used: hook_menu

Now that we have a working module, we'd like to make it more flexible. If we have a site that has been around for a while, content from a week ago might not be as interesting as content from a year ago. Similarly, if we have a busy site, we might not want to display all the links to content created last week. So, let's create a configuration page for the administrator to adjust how many links to display, and leave it at that for this tutorial.

Create the configuration function

We'd like to configure how many links display in the block, so we'll create a form for the administrator to set the number of links. The first step in doing that is to define a "system settings" form page, using the Drupal Forms API. Since this is our "administer" page, we'll call the function that generates the function onthisdate_admin() (or we could choose another name, but it should start with onthisdate_ ) and put it into our onthisdate.module file:

<?php
function onthisdate_admin() {
$form = array();

$form['onthisdate_maxdisp'] = array(
'#type' => 'textfield',
'#title' => t('Maximum number of links'),
'#default_value' => variable_get('onthisdate_maxdisp', 3),

Pages

Subscribe with RSS Subscribe to RSS - Drupal 6.x