<!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.&nbsp; 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>&nbsp;</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>&nbsp;</DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2>mymod_foo calls theme()&nbsp; to make sure that the output is 
themeable.&nbsp; (by phptemplate or other theme engines)</FONT></SPAN></DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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&nbsp;&nbsp;template is specified by the designer. </FONT></SPAN></DIV>
<DIV><SPAN class=078442320-10042007><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</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>&lt;snip&gt;<BR><FONT size=2>
<P>#################################################</P>
<P>module code - mymod.php</P>
<P>#################################################</P>
<P>function mymod_foo() {</P>
<P>$data = array('foo' =&gt; '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>&nbsp;</P>
<P>#################################################</P>
<P>foo_or_something.tpl.php</P>
<P>#################################################</P>
<P>&lt;h1&gt;I want to output value of $foo 
here&lt;/h1&gt;</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.&nbsp; I understand the approach you outline 
and have been using it exclusively so far.&nbsp; 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.&nbsp; 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> &lt;<A 
href="mailto:metzlerd@evergreen.edu">metzlerd@evergreen.edu</A>&gt; 
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.&nbsp; In this case, the html output represented by 
  $foo is presented in the content area of page.tpl.&nbsp; 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>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN>Now 
  you&nbsp; 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>&nbsp;</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.&nbsp; If I create a 
  custom module how do I use the templating engine to work with the output of 
  the module?&nbsp; I know this code is bad, but it summarizes what I would like 
  to do.&nbsp; 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>&nbsp; $items = array();<BR>&nbsp; $items[] = 
  array('path' =&gt; 'mymod_view', <BR>&nbsp; 'title' =&gt; 
  t('mymod_view'),<BR>&nbsp; 'callback' =&gt; 'mymod_foo',<BR>&nbsp; 'type' 
  =&gt; MENU_LOCAL_TASK,<BR>&nbsp; 'access' =&gt; user_access('view 
  mymod'),<BR>&nbsp; 'weight' =&gt; 0, <BR>&nbsp; );<BR>&nbsp; return 
  $items;<BR>}<BR><BR>function mymod_foo() {<BR>&nbsp; $data = array('foo' =&gt; 
  'bar');<SPAN><FONT face=Arial color=#0000ff 
  size=2>&nbsp;</FONT></SPAN></DIV></SPAN>
  <DIV><SPAN><FONT face=Arial color=#0000ff size=2>&nbsp; $output 
  =&nbsp;'&lt;h1&gt;Here is the value of&nbsp;'.$data['foo'].' here. 
  &lt;/h1&gt;';&nbsp;</FONT></SPAN><SPAN><FONT face=Arial color=#0000ff 
  size=2>&nbsp;</FONT></SPAN><BR>&nbsp; return $<SPAN><FONT face=Arial 
  color=#0000ff 
  size=2>output&nbsp;</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>