Introduce phorum_custom_get_template ?
Posted by arkadio
All files from this thread
File Name | File Size | Posted by | Date | ||
---|---|---|---|---|---|
phorum_get_template.php | 1.2 KB | open | download | arkadio | 07/01/2004 | Read message |
mydms.php | 2.1 KB | open | download | arkadio | 07/02/2004 | Read message |
Introduce phorum_custom_get_template ? July 01, 2004 10:59AM |
Registered: 20 years ago Posts: 2 |
I suggest it is a good idea to modify phorum_get_template, so that it can check for existence of custom function for that:
=====================================================
function phorum_get_template($page)
{
$PHORUM =& $GLOBALS["PHORUM"];
if(!empty($PHORUM["args"]["template"])) {
$PHORUM["template"]=basename($PHORUM["args"]["template"]);
}
if(isset($PHORUM['user']['user_template'])) {
$PHORUM['template']=$PHORUM['user']['user_template'];
}
if(empty($PHORUM["template"])){
$PHORUM["template"]=$PHORUM["default_template"];
}
// Check for CUSTOM function
if(function_exists("phorum_custom_get_template")){
return phorum_custom_get_template($page, $PHORUM[template]);
}
$tpl="./templates/$PHORUM[template]/$page";
// check for straight PHP file
if(file_exists("$tpl.php")) {
$phpfile="$tpl.php";
} else {
// not there, look for a template
$tplfile="$tpl.tpl";
$phpfile="$PHORUM[cache]/tpl-$PHORUM[template]-$page-".md5(dirname(__FILE__)).".php";
if(!file_exists($phpfile) || filemtime($tplfile) > filemtime($phpfile)){
include_once "./include/templates.php";
phorum_import_template($tplfile, $phpfile);
}
}
return $phpfile;
}
=====================================================
function phorum_get_template($page)
{
$PHORUM =& $GLOBALS["PHORUM"];
if(!empty($PHORUM["args"]["template"])) {
$PHORUM["template"]=basename($PHORUM["args"]["template"]);
}
if(isset($PHORUM['user']['user_template'])) {
$PHORUM['template']=$PHORUM['user']['user_template'];
}
if(empty($PHORUM["template"])){
$PHORUM["template"]=$PHORUM["default_template"];
}
// Check for CUSTOM function
if(function_exists("phorum_custom_get_template")){
return phorum_custom_get_template($page, $PHORUM[template]);
}
$tpl="./templates/$PHORUM[template]/$page";
// check for straight PHP file
if(file_exists("$tpl.php")) {
$phpfile="$tpl.php";
} else {
// not there, look for a template
$tplfile="$tpl.tpl";
$phpfile="$PHORUM[cache]/tpl-$PHORUM[template]-$page-".md5(dirname(__FILE__)).".php";
if(!file_exists($phpfile) || filemtime($tplfile) > filemtime($phpfile)){
include_once "./include/templates.php";
phorum_import_template($tplfile, $phpfile);
}
}
return $phpfile;
}
Re: Introduce phorum_custom_get_template ? July 01, 2004 12:25PM |
Admin Registered: 22 years ago Posts: 9,240 |
Re: Introduce custom_get_template ? July 02, 2004 03:50AM |
Registered: 20 years ago Posts: 2 |
Basically, I am integrating Phorum into a CMS (specifically, MyDMS). I need to output different .tpl segments in at different points and not to show header and footer.
I want to use a buffer to store template output.
Here is a quick solution that works:
in phorum_get_template()
if(function_exists("phorum_custom_get_template")){
return phorum_custom_get_template($page, $phpfile);
}
return $phpfile;
and then - see attached file
I want to use a buffer to store template output.
Here is a quick solution that works:
in phorum_get_template()
if(function_exists("phorum_custom_get_template")){
return phorum_custom_get_template($page, $phpfile);
}
return $phpfile;
and then - see attached file
Sorry, only registered users may post in this forum.