Hi,
I'm developing a custom module. I have found this useful article about overriding theme functions. http://drupal.org/node/11811. It's working correctly for theme functions already in the drupal theme system. For example: theme_item_list();
The problem is: I have wrote my own code, but it seems drupal does not recognize it like a node theme:
function phptemplate_esorg_item($items = array(), $title = NULL) {
return _phptemplate_callback('esorg_item', array('items' => $items, 'title' => $title));
}
I've wrote my template file: esorg_item.tpl.php
<div class="node<?php print ($sticky) ? " sticky" : ""; ?>">
<? foreach ($items as $item) {?>
<? print $item?>
<? } ?>
</div>
...and from my custom module I call the theme like this:
$items = Array("Test1", "Test2", "Test3");
print theme("esorg_item", $items, "Test page");
The output I get, when I navigate to my module in a webbrowser is:
<div class="node">
Test1 Test2 Test3
<h2><a href="" title="Test page">Test page</a></h2>
<div class="node-content">
</div>
</div>
So as you see, there is missing the full page template html code. It seems drupal recognize my module as a page template, like: page.tpl.php, but I would like to use my theme function output as a node.
If I modify the theme_item_list();
(or any other that is already in drupal) functions, like in the article, it is works correctly, but as I change the name of the theme function it is not.
Any idea? I think I have to tell drupal about my theme function that is not a page theme function, but I can't figure out how?
Thanx
Tamas