CuteNews

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> [HACK] Random Category, Switch between categories randomly
John/Will
post Sep 27 2004, 06:25 PM
Post #1


CuteHack: Technician
***

Group: Support
Posts: 2,986
Joined: 3-July 04
From: Channel Islands
Member No.: 46



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:


CODE
<?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 smile.gif

$numbers = array(); is where you input the category ids. Might not work with subcategories but you can always try.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 20th May 2013 - 09:35 AM