我有以下代码可供使用:
<?php
function getArticleDbImage($item){
global $db;
if(!$db){
$db =&JFactory::getDBO();
}
//echo "dt: ".$item->created;
$artclDatArr = explode("-",$item->created);
$plugin =& JPluginHelper::getPlugin('content','setimage');
$pluginParams = new JParameter($plugin->params);
$query = 'SELECT a.images FROM #__content AS a WHERE id=' . $item->id;
$db->setQuery($query);
$images = $db->loadRow();
//print_r($images);
$db_image_path = $pluginParams->get('db_image_path', 'images/stories/db_images/');
$add_default_img = $pluginParams->get('add_default_img', '1');
$default_img_url = $pluginParams->get('default_img_url', '');
if($images[0]){
$imgNameArr = explode(".", $images[0]);
$image = rtrim($db_image_path,'/') . "/" . $artclDatArr[0] . "/" . ltrim($artclDatArr[1],'0') . "/" . $imgNameArr[0] . '_e.' . $imgNameArr[1];
} else {
$image = $default_img_url;
}
//echo "img: ".$fn_image;
return $image;
}
extract($_REQUEST);
?>
以上代码给出了错误:Jfactory class not found