Firefox PHP

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
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;
}

Attachments:
open | download - phorum_get_template.php (1.2 KB)
Re: Introduce phorum_custom_get_template ?
July 01, 2004 12:25PM
for which use? what would you do with such a function?


Thomas Seifert
Re: Introduce custom_get_template ?
July 02, 2004 03:50AM
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
Attachments:
open | download - mydms.php (2.1 KB)
Sorry, only registered users may post in this forum.

Click here to login