<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=078442320-10042007><FONT face=Arial 
color=#0000ff size=2>See Larry Garfields response for the full answer.  He 
provided an excellent example. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=078442320-10042007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=078442320-10042007><FONT face=Arial 
color=#0000ff size=2><STRONG>in Your module: </STRONG></FONT></SPAN></DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2>mymod_foo calls theme()  to make sure that the output is 
themeable.  (by phptemplate or other theme engines)</FONT></SPAN></DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2>theme_foo_or_something() provides the default view if not overriden by 
the theme. </FONT></SPAN></DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2><STRONG>in the template.php file for the php template theme: 
</STRONG></FONT></SPAN></DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2>phptemplate_foo_or_somthing() matches up the foo_or_something.tpl file 
with the intercepted theme function. </FONT></SPAN></DIV>
<DIV><SPAN class=078442320-10042007><STRONG><FONT face=Arial color=#0000ff 
size=2></FONT></STRONG></SPAN> </DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2><STRONG>in the foo_or_something.tpl</STRONG></FONT></SPAN></DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff size=2>The 
overriden  template is specified by the designer. </FONT></SPAN></DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2>Larry's post is as follows: </FONT></SPAN></DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2><snip><BR><FONT size=2>
<P>#################################################</P>
<P>module code - mymod.php</P>
<P>#################################################</P>
<P>function mymod_foo() {</P>
<P>$data = array('foo' => 'bar');</P>
<P>return theme('foo_or_something', $data); }</P>
<P>function theme_foo_or_someting($data) {</P>
<P>return "something you do with $data that generates a string"; }</P>
<P>#################################################</P>
<P>template.php code</P>
<P>#################################################</P>
<P>function phptemplate_foo_or_something() {</P>
<P>return _phptemplate_callback('foo_or_something', $data); }</P>
<P> </P>
<P>#################################################</P>
<P>foo_or_something.tpl.php</P>
<P>#################################################</P>
<P><h1>I want to output value of $foo 
here</h1></P></FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> support-bounces@drupal.org 
[mailto:support-bounces@drupal.org] <B>On Behalf Of 
</B>Cyberswat<BR><B>Sent:</B> Tuesday, April 10, 2007 1:08 PM<BR><B>To:</B> 
support@drupal.org<BR><B>Subject:</B> Re: [support] Templating in Drupal 5.1 - 
the cleanest way to do it?<BR></FONT><BR></DIV>
<DIV></DIV>Thanks for the response.  I understand the approach you outline 
and have been using it exclusively so far.  I'm starting to work with 
structures that are more complex than my original example and would ultimately 
like to task a designer to create/modify the tpl files without editing the 
module at all.  How do I go about invoking the theme engine to accomplish 
this in a similar to my original example? <BR><BR>
<DIV><SPAN class=gmail_quote>On 4/10/07, <B class=gmail_sendername>Metzler, 
David</B> <<A 
href="mailto:metzlerd@evergreen.edu">metzlerd@evergreen.edu</A>> 
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote 
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
  <DIV>
  <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN>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. </SPAN></FONT></DIV>
  <DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
  size=2><SPAN></SPAN></FONT> </DIV>
  <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN>Now 
  you  could invoke the theme engine as well, but I wanted to make sure you 
  understood this easier way first. </SPAN></FONT></DIV>
  <DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
  size=2><SPAN></SPAN></FONT> </DIV>
  <DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
  size=2><SPAN>Dave</SPAN></FONT></DIV><BR>
  <DIV lang=en-us dir=ltr align=left>
  <HR>
  <FONT face=Tahoma size=2><B>From:</B> <A 
  onclick="return top.js.OpenExtLink(window,event,this)" 
  href="mailto:support-bounces@drupal.org" 
  target=_blank>support-bounces@drupal.org</A> [mailto:<A 
  onclick="return top.js.OpenExtLink(window,event,this)" 
  href="mailto:support-bounces@drupal.org" 
  target=_blank>support-bounces@drupal.org</A>] <B>On Behalf Of 
  </B>Cyberswat<BR><B>Sent:</B> Tuesday, April 10, 2007 11:47 AM<BR><B>To:</B> 
  <A onclick="return top.js.OpenExtLink(window,event,this)" 
  href="mailto:support@drupal.org" 
  target=_blank>support@drupal.org</A><BR><B>Subject:</B> Re: [support] 
  Templating in Drupal 5.1 - the cleanest way to do 
  it?<BR></FONT><BR></DIV><SPAN class=q>
  <DIV></DIV>
  <DIV>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. 
  <BR><BR>#################################################<BR>module code - 
  mymod.php<BR>#################################################<BR><BR>function 
  mymod_menu($may_cache) {<BR>  $items = array();<BR>  $items[] = 
  array('path' => 'mymod_view', <BR>  'title' => 
  t('mymod_view'),<BR>  'callback' => 'mymod_foo',<BR>  'type' 
  => MENU_LOCAL_TASK,<BR>  'access' => user_access('view 
  mymod'),<BR>  'weight' => 0, <BR>  );<BR>  return 
  $items;<BR>}<BR><BR>function mymod_foo() {<BR>  $data = array('foo' => 
  'bar');<SPAN><FONT face=Arial color=#0000ff 
  size=2> </FONT></SPAN></DIV></SPAN>
  <DIV><SPAN><FONT face=Arial color=#0000ff size=2>  $output 
  = '<h1>Here is the value of '.$data['foo'].' here. 
  </h1>'; </FONT></SPAN><SPAN><FONT face=Arial color=#0000ff 
  size=2> </FONT></SPAN><BR>  return $<SPAN><FONT face=Arial 
  color=#0000ff 
  size=2>output </FONT></SPAN>;<BR>}<BR><BR><BR><BR></DIV></DIV><BR>--<BR>[ 
  Drupal support list | <A 
  onclick="return top.js.OpenExtLink(window,event,this)" 
  href="http://lists.drupal.org/" target=_blank>http://lists.drupal.org/</A> 
  ]<BR></BLOCKQUOTE></DIV><BR><BR clear=all><BR>-- <BR><BR>Kevin Bridges<BR><A 
href="http://www.kevinbridges.org/">http://www.kevinbridges.org/</A> 
</BODY></HTML>