NAVIGATION
A quite simple solution to show a random category by alias- or id and show the result at the place of the TAGs {RANDOMCATEGORY_ALIAS} / {RANDOMCATEGORY_ID}.
rt_random_category_alias V1.0 18.07.10
Docu: –
Forum: http://forum.phpwcms.org/viewtopic.php?f=28&t=20397
Author: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.3
Version: V1.0
Tag: {RANDOMCATEGORY}
Filename: rt_random_category_alias.php
Folder: template/inc_script/frontend_render/
Condition: → /config/phpwcms/conf.inc.php
<?php /** ********************************************************************************************* * 18.07.10 KH: http://planmatrix.de V1.0 * frontend_render-Script: Random category alias/id * Update 19.07.2010 KH: Two Tags {RANDOMCATEGORY_ALIAS} and {RANDOMCATEGORY_ID} ********************************************************************************************* */ // ------------------------------------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ------------------------------------------------------------------------------------------- if (strpos($content["all"], '{RANDOMCATEGORY_') ) { $hidden_category = array(); // CUSTOM: All not available categories like 22,47,56,... $id = array_rand ( $content["struct"], 1 ); while ($content["struct"][$id]["acat_hidden"] != 0 OR $content["struct"][$id]["acat_regonly"] != 0 OR in_array($id, $hidden_category) ) $id = array_rand ( $content["struct"], 1 ); // Output alias $content["all"] = str_replace('{RANDOMCATEGORY_ALIAS}',$content["struct"][$id]["acat_alias"],$content["all"] ); // Output id $content["all"] = str_replace('{RANDOMCATEGORY_ID}',$id,$content["all"] ); } ?>