By nathanpalmer on
I know I have got to be missing something simple. But I'm trying to pass out the theming to a php template file for my module? I have my _menu hook calling the theme function and the theme_debtlist() function works fine. But the debtlist.tpl.php is not working. Here is where I call the theme
$debts = array();
do
{
$debt->creditor = $debt_node->creditor;
$debt->credit_type = $debt_node->credit_type;
$debt->balance = $debt_node->balance;
$debt->name = $debt_node->name;
$debts[] = $debt;
}
while ($debt_node = db_fetch_object($result));
$output = theme('debtlist', $debts);
Here is my theme_debtlist() function
function theme_debtlist($debts) {
$creditOptions = Credit_Options();
$output .= "<div>";
$output .= " <h3>Debt information Summary</h3>";
$output .= " <table style=\"width: 100%;\">";
$output .= " <tbody>";
foreach($debts as $debt_index => $debt_node) {
$output .= " <tr>";
$output .= " <th>Creditor</th>";
$output .= " <td>" . $debt_node->creditor . "</td>";
$output .= " </tr>";
$output .= " <tr>";
$output .= " <th>Credit Type</th>";
$output .= " <td>" . $creditOptions[(int)$debt_node->credit_type] . "</td>";
$output .= " </tr>";
$output .= " <tr>";
$output .= " <th>Balance</th>";
$output .= " <td>" . $debt_node->balance . "</td>";
$output .= " </tr>";
$output .= " <tr>";
$output .= " <td><a href = \"/" . $debt_user->name . "/debt/" . $debt_node->nid . "\">View Debt</a> - <a href = \"/node/" . $debt_node->nid . "/edit\">Edit Debt</a></td>";
$output .= " </tr>";
}
$output .= " </tbody>";
$output .= " </table>";
$output .= "</div>";
return $output;
}
I created a debtlist.tpl.php file in my default theme directory with just the word "test" in it. But it's not overriding the theme_debtlist function.
Any ideas? I've gone over the privatemsg module which is doing something similar and I can't find any differences.
Thanks,
Nathan
Comments
template.php
Did you remember to add the override to the template.php file?
Overriding theme functions
That fixed it. I didn't
That fixed it. I didn't realize I had to do that. I really appreciate it.
Thanks,
Nathan