Adding a 'more' link and showing all entries

Last modified: June 10, 2009 - 15:20

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 the onthisdate_block() function. These lines will add the more link to the end of the $block_content variable before saving it to the $block['content'] variable:

<?php
// add a more link to our page that displays all the links
 
$block_content .=
   
"<div class=\"more-link\">".
   
l(
     
t("more"),
     
"onthisdate",
      array(
       
"title" => t("More events on this day.")
      )
    ).
"</div>";
?>

This will add the more link to the block. Note the extra parameters used in the l() function. You can add additional values, such as 'class', in the array to customize the link.

For more information about the l() function see the API documentation.

 
 

Drupal is a registered trademark of Dries Buytaert.