Big Text content in nodes

cdecker - October 30, 2009 - 16:34

I'm trying to create a Module that in some cases needs to display some rather long text contents (mainly explanation text) and I was wondering if there was a way to use the node system to include a text-node instead.

Also is there a simple way to import these text-nodes during the installation of my module?

Regards,
Chris

It sounds like what you want

rschwab - October 30, 2009 - 18:45

It sounds like what you want to do is use the menu system to create some menu callbacks that display your text. If you went that route you wouldn't need to do anything at installation - Drupal will include your new pages when it rebuilds the menu tables. If there is a way to specifically use the node system for this, I'm unaware of it. Generally if you just want a module to create some pages programatically, the menu system is the way to go, IMHO.

Here is a sample of using hook_menu to accomplish this:

<?php

/**
* Implementation of hook_menu
*/
function advprofilesearch_menu() {
   
$items['my-search-page'] = array(
       
'title' => t('Find A Family'),
       
'page callback' => 'advprofilesearch_page',
       
'type' => MENU_CALLBACK,
       
'access callback' => 'user_access',
       
'access arguments' => array('use advprofile search'),
    );
   
    return
$items;
}
?>

From there you would make a function like:

<?php
function advprofilesearch_page() {
       
$output = 'your html';
           
$output .= 'more of your text';
    return
$output;   
}
?>

Good luck!
- Ryan

 
 

Drupal is a registered trademark of Dries Buytaert.