A simple link to a random post plugin. I already have it: a friend of mine wrote it before Nucleus plugins were implemented, so it works out of Nucleus, using its own functions to connect the mysql tables etc.
I tried to transform it in a plugin, without success. This is because the script uses functions and classes stored in a separated file and I couldn't get all of them to work in a plugin.
This is the main script code:
(php) <?
include('../connect.php');
$con = conecta();
$sql = "SELECT max(inumber) as max FROM nucleus_item";
// echo "<br>sql = $sql";
$rs=executequery($con,$sql);
if (!$rs->eof()) {
$max_id = $rs->getcurrentfield("max");
}
$rs->freeresources();
// echo "<br>max_id = $max_id";
for ($i=1;$i<20;$i++) {
$inumber_db = rand (1, $max_id);
$sql = "SELECT inumber,ibody FROM nucleus_item
WHERE inumber = $inumber_db";
// echo "<br>sql = $sql";
$rs=executequery($con,$sql);
if (!$rs->eof()) {
$inumber = $rs->getcurrentfield("inumber");
$link_db = "http://www.tipos.com.br/blog/index.php?itemid=$inumber";
$i = 20;
}
$rs->freeresources();
}
echo "<html>
<head>
<title>tipos.com.br</title>
<META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=$link_db\">
</head>
<body bgcolor=\"#FFCC00\">
<br><br><br><br><br><br>
<center>
<span style=\"font-family: Tahoma, Verdana, Arial; font-size: 24px; font-weight: bold; line-height: 36px\">You will be now redirected to the post <a href=\"$link_db\">$inumber</a>.
</span>
</center>
</body>
</html>";
fecha ($con);
?>
Can anybody help?
Just a suggestion, why not use the code of random, and feed it possible itemId's instead of a text file. Then using the sticky plugin to see an example of how to display 1 item and you're done. If I had some time I would implement this for you. But my hands are tight at the moment
Wouldn't this solve your problem? http://wakka.[[xiffy.nl/RandomEntry]]
Greets, eugenandreas@yahoo.de