1
Hi to everyone!
I'm trying to create a personalized block. It would have to show one product, random, from the database.
I've written the correct code in php. If I load it, not in a block, it's really ok!
But I don't know how to put the script in the fuction of the block!
Can someone help me, please?
This is the php script:
include '../../../mainfile.php';
include XOOPS_ROOT_PATH.'/header.php';
$link = '../adsitem.php?ads_id='.$ads_id;
$sql = "SELECT * FROM ".$xoopsDB ->prefix ("catads_ads")." order by rand() limit 1 ";
$rs = $xoopsDB ->query ($sql);
$row = $xoopsDB ->fetchArray ($rs);
echo $row[ads_title]."
";
echo $row[ads_desc]."
";
echo ".$link.">.$row[photo0].">";
This is the code of an empty block:
function vetrina_show($options) {
$block['content'] = '
';
return $block;
}
?>
Thanks, bye.
Ste