A few weeks ago, as an experiment, I wrote an alternative version of _loadContentElement() which loads the config data from php files instead of xml. This is faster than xml and also can be cached by my php accelerator.
It also eliminates the need to use the domit lib :)
Code:
/** Loading of related mbf.php files
*/
function _loadContentElements() {
// Try to find the PHP files
$filesindir = mosReadDirectory($this->_adminPath ."/contentelements2" ,".mbf.php");
if(count($filesindir) > 0)
{
foreach($filesindir as $file)
{
// can't do include_once since in the admin function this gets called twice!!!
include( $this->_adminPath . "/contentelements2/" . $file);
}
foreach($phpContentElement as $tempContentElement )
{
$contentElement =& new ContentElement2( $tempContentElement );
$this->_contentElements[$contentElement->getTableName()] =& $contentElement;
}
}
}
The format of the .mbf.php files is straightforward - here is the one I use for content
Code:
<?php
$tempContentElement = array("type" => "contentelement",
"name" => "Contents",
"author" => "A. Kempkens",
"version" => "1.0",
"description" => "Definition for Mambo content",
"tabletype" => "content",
"filter" => "c.state >= 0",
"tablename" => "content");
$tempContentElement["fields"][]=array("type"=>"referenceid","name" => "id","translate" =>"0", "label" => "ID");
$tempContentElement["fields"][]=array("type"=>"titletext","name" => "title","translate" =>"1", "label" => "Title");
$tempContentElement["fields"][]=array("type"=>"htmltext","name" => "introtext","translate" =>"1", "label" => "Introtext");
$tempContentElement["fields"][]=array("type"=>"htmltext","name" => "fulltext","translate" =>"1", "label" => "Fulltext");
$tempContentElement["fields"][]=array("type"=>"created_date","name" => "created","translate" =>"0", "label" => "Created");
$tempContentElement["fields"][]=array("type"=>"modified_date","name" => "modified","translate" =>"0", "label" => "Modified");
$tempContentElement["fields"][]=array("type"=>"checked_out_by","name" => "checked_out","translate" =>"0", "label" => "Check out by");
$tempContentElement["fields"][]=array("type"=>"checked_out_date","name" => "checked_out_time","translate" =>"0", "label" => "Check out date");
$phpContentElement[$tempContentElement["tablename"]]=$tempContentElement;
?>
The same approach could easily be adopted for the language xml files.
Alex - Would this provide a solution to the PHP 4.4.0 problem?
Geraint
p.s. I have a batch of mbf.php files already converted from xml