I'm trying to replace the output of $submitted
in my nodes. I have found how to replace the value which is fine. The problem I'm facing is how to load a template file properly.
function pod_preprocess_node(&$vars) {
$vars['submitted'] = t('!datetime ', array(
'!datetime' => include_once(__DIR__.'/system/submitted.tpl.php')
));
}
As you can see above, I've just included a template file and in there I can use $vars but this is clearly sub optimal. What I'd like to do is just load a template file from my theme which has some sensibly named variables in.
I've looked at hook_theme()
which now allows me to call theme('pod_submitted', $vars)
but I don't know how to make pod_submitted()
include the right file etc.
I assume that somewhere I need to do the following
$vars['theme_hook_suggestions'][] = 'system__submitted';
But I'm not sure how my template function relates to/knows which template to call.
$submitted
into lots of variables and output them in node.tpl.php individually but I want to just change the output across the board. At the moment my HTML is in my hook_preprocess_node() method which is not ideal. I want to put it in a template file so that it can be themed more appropriately.