NAVIGATION
This is an old revision of the document!
Eine einfache Lösung für die zufällige Auswahl einer/s Kategorie-Alias- oder id und der Darstellung an der Stelle des TAGs {RANDOMCATEGORY}.
rt_random_category V1.0 18.07.10
Docu: –
Forum: http://forum.phpwcms.org/viewtopic.php?f=28&t=20397
Autor: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.3
Version: V1.0
Tag: {RANDOMCATEGORY}
Dateiname: rt_random_category.php
Verzeichnis: template/inc_script/frontend_render/
Bedingung: → /config/phpwcms/conf.inc.php
<?php /** ********************************************************************************************* * 18.07.10 KH: http://planmatrix.de V1.0 * frontend_render-Script: Random category alias/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}') ) { $id = array_rand ( $content["struct"], 1 ); while ($content["struct"][$id]["acat_hidden"] != 0 OR $content["struct"][$id]["acat_regonly"] != 0) $id = array_rand ( $content["struct"], 1 ); // Output alias $content["all"] = str_replace('{RANDOMCATEGORY}',$content["struct"][$id]["acat_alias"],$content["all"] ); // Output id // $content["all"] = str_replace('{RANDOMCATEGORY}',$id,$content["all"] ); } ?>
Wenn die ID anstatt des Alias gebraucht wird, bitte die Zeile nach ”// Output id” entkommentieren und die Zeile nach ”// Output alias” kommentieren.