1 (edited by 2008-08-21 19:56:30)

Topic: [HACK] Random Category

Name: show news from a random category.
Author: John/Will
Contributed by: StealthEye
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: Make a page which shows news from 1 category, picked out of a list of different categories.
Instructions:


<?php
if (empty($subaction)) {
  $numbers = array(x,xx,xxx,x,xx,xxx,x,xx,xxx);
  $random = $numbers[rand(0,count($numbers)-1)];
  $category= $random;
}

$template = "your-template";
$number = "xxx";
include("cutenews/show_news.php");
?>

Use the above instead of your standard CN include code.

This could be useful for some people http://cutephp.com/forum/style_emoticons/default/smile.gif

$numbers = array(); is where you input the category ids.  Might not work with subcategories but you can always try.