Knowledge Base Funktion für Template Parsing ändern
Verfasst: 02.02.2012 16:58
Ich würde mal die Hilfe eines erfahrenen Coders benötigen.
Da es im Moment keine brauchbare Alternative gibt teste ich gerade die [ABD] PhpBB3 Knowledge Base MOD.
In der Datei
Das Problem ist, dass damit keine "Template inheritance" funktioniert. Daher habe ich die Zeile:
dadurch ersetzt
Das funktioniert zwar, ich habe aber das Gefühl, dass man das besser lösen könnte. Weiß jemand Rat?
Da es im Moment keine brauchbare Alternative gibt teste ich gerade die [ABD] PhpBB3 Knowledge Base MOD.
In der Datei
includes/functions_kb_plugins.php
gibt es folgende Funktion zum Parsen der Plugin TemplatesCode: Alles auswählen
/**
* Parse a template and return the parsed text
*
* This function should be used for ALL plugins that normally use $template->assign_display to output data with the plugin system.
*/
function kb_parse_template($filename, $template_file)
{
global $phpbb_root_path, $template, $user;
$tpl_path = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/kb/plugins/';
// If the template file does not exist
if (!file_exists($tpl_path . $template_file))
{
$error = sprintf($user->lang['PLUGIN_TEMPLATE_MISSING'], $template_file);
trigger_error($error);
}
$template_path = 'kb/plugins/';
$template->set_filenames(array(
$filename => $template_path . $template_file,
));
// return the output
return $template->assign_display($filename);
}
Code: Alles auswählen
$tpl_path = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/kb/plugins/';
Code: Alles auswählen
if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/kb/plugins/'))
{
$tpl_path = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/kb/plugins/';
}
else if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template/kb/plugins/'))
{
$tpl_path = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template/kb/plugins/';
}