How do I create a page consist of more than 100 lines, by custom module? I created a page which consist of HTML tags. The code for that is the following one:

function mynewpage_menu() {
  $items['mypage'] = array(
    'title' =&gt; 'my page title',
    'page callback' =&gt; 'mypage_page',
    'access arguments' =&gt; array('administer page'),
  ); 
  return $items;
}

function mypage_page() {    
  $output='html code here';
  return $output
}


Is it the right way to generate a page if i have more than 100 lines? What if I have iframe , img and canvas tags and what if I want to include paths and hyper references?

In what other ways can I generate a page containing 100 HTML tags?

Update:
Am I right in associating mynew-page.tpl.php with the following theme function?

function mymodule_theme() {
  return array(
    'mypage' =&gt; array(
      'variables' =&gt; array('account' =&gt; NULL),
      'template' =&gt; 'mynew-page',
    ),
  );
}
There isn't a limit on the number of lines returned by a page callback, or on the number of tags it can return.
If the output is getting complex, it's rather better to separate the code into different theme functions; for example, for outputting a link there is l(), for outputting an image there is theme('image'), and for outputting a table there is theme('table'). The first rule is to reuse the existing functions.

In Drupal 7, a page callback can also return a renderable array, such as the following one returned by tracker_page():

  $page['tracker'] = array(
    '#rows' =&gt; $rows, 
    '#header' =&gt; array(t('Type'), t('Title'), t('Author'), t('Replies'), t('Last updated')), 
    '#theme' =&gt; 'table', 
    '#empty' =&gt; t('No content available.'), 
    '#attached' =&gt; array(
      'css' =&gt; array(drupal_get_path('module', 'tracker') . '/tracker.css' =&gt; array()),
    ),
  );
  $page['pager'] = array(
    '#theme' =&gt; 'pager', 
    '#quantity' =&gt; 25, 
    '#weight' =&gt; 10,
  );
  $page['#sorted'] = TRUE;

  return $page;


In these cases, the page callback doesn't return any HTML tags. This is also the preferred method, in Drupal 7, as it allows to the other modules to easily change the output of another module.

As alternative, you can use a template file for rendering the output. In this case, you need to:


Define a theme function that uses the template file; that is what is done from the Node module for theme('node'), which is defined in node_theme() using the following definition (Drupal 7):

'node' =&gt; array(
  'render element' =&gt; 'elements', 
  'template' =&gt; 'node',
), 

Optionally create a preprocess and/or a process function for the template, their purpose is to add variables to the ones that are passed to the template file. In the case of the Node module, those functions are template_preprocess_node() and template_preprocess_node().
Invoke the theme function to produce the output. In the case of theme('node'), this is done as in the following code:

// Drupal 6.
return theme('node', $node, $teaser, $page);

// Drupal 7.
$build += array(
  '#theme' =&gt; 'node', 
  '#node' =&gt; $node, 
  '#view_mode' =&gt; $view_mode, 
  '#language' =&gt; $langcode,
);



Update
This is a common error: The template file name and the theme name must not be different; the only difference can be between using hyphens and using underscores. For the rest, the theme name and the template filename must be the same, which means that "mypage" as theme function and "mynew-page" as template filename don't work; if you are going to use "mynew-page" as template file, then the theme function must be theme_mynew_page(), reported in the theme definition as "mynew_page."