Most drupal's modules are based on node's contents.
I would like to create some of the contents do not have to drupal's node; I don't know whether to do so with drupal.
There is the development of guidelines or modules?

Comments

nevets’s picture

Why don't you want them to be nodes, you lose a lot going that way.

drupal66@drupalchina.org’s picture

All drupal's contents are stored in the two associated table of node and node_revisions , if the volume of data and site visits increased to a certain extent, the site's speed will sharp decline;Another is not conducive to safeguarding data.

Therefore, I would like to create different from the contents of nodes(Or non-Node node content),Mainly want to save data in different table.But I do not know if there are such reference or others to provide the module?

meric’s picture

Why not just create content via modules? That way these "non-node" contents are not saved in the node tables. These are best applied if you want to minimize database hits.

drupal66@drupalchina.org’s picture

I think so, but my "non-node" contents how to be viewed, and do not like conment ?

meric’s picture

You can create them via hook_menu(). However these will be more of "content pages" rather than the standard drupal "nodes". They also can't be edited via the browser, as the contents are coded in the module files instead of being stored in the drupal database.

I have an example, let's say I have a module named mymodule. I have in my .module file a function mymodule_menu():

/**
* Implementation of hook_user();
*/
function mymodule_menu() {
  $items = array();
  $items[] = array(
      'path' => 'mypage',
      'callback' => 'mymodule_mypage_view',
      'access' => true,
      'type' => MENU_CALLBACK,
    );
   return $items;
  }

This will create a node with a path 'mypage'. The contents of this page have to be provided by your callback, which in our case is mymodule_mypage_view:

/**
* Callback for mypage, this where we create content.
*/
function mymodule_mypage_view() {
global $user;
  $output = "<h1>Hello World!</h1>";
  $output .= "<br>Greetings, $user->name !";
  return $output;
}