[support] Templating in Drupal 5.1 - the cleanest way to do it?

Metzler, David metzlerd at evergreen.edu
Tue Apr 10 19:12:14 UTC 2007


Easiest way is the the following.  In this case, the html output
represented by $foo is presented in the content area of page.tpl.  Note
you don't need custom theme functions and custom tpl files to do this. 
 
Now you  could invoke the theme engine as well, but I wanted to make
sure you understood this easier way first. 
 
Dave

________________________________

From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On
Behalf Of Cyberswat
Sent: Tuesday, April 10, 2007 11:47 AM
To: support at drupal.org
Subject: Re: [support] Templating in Drupal 5.1 - the cleanest way to do
it?


I have another question regarding this subject.  If I create a custom
module how do I use the templating engine to work with the output of the
module?  I know this code is bad, but it summarizes what I would like to
do.  Any help is appreciated as I'm starting to feel dense from not
being able to figure this out. 

#################################################
module code - mymod.php
#################################################

function mymod_menu($may_cache) {
  $items = array();
  $items[] = array('path' => 'mymod_view', 
  'title' => t('mymod_view'),
  'callback' => 'mymod_foo',
  'type' => MENU_LOCAL_TASK,
  'access' => user_access('view mymod'),
  'weight' => 0, 
  );
  return $items;
}

function mymod_foo() {
  $data = array('foo' => 'bar'); 
  $output = '<h1>Here is the value of '.$data['foo'].' here. </h1>';  
  return $output ;
}




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20070410/3715d2f6/attachment.htm 


More information about the support mailing list