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:
le="color: #000000"><?php 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]."<br>"; echo $row[ads_desc]."<br>"; echo "<a href=".$link."><img src=../images/ads/".$row[photo0]."></a>";
This is the code of an empty block:
<?php function vetrina_show($options) { $block['content'] = ' '; return $block; } ?>
Thanks, bye.
Ste