This is an old revision of the document!


RANDOMCATEGORY

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

  • $phpwcms['allow_ext_render'] = 1;



Script:

rt_random_category

<?php
 
/**
*********************************************************************************************
* 18.07.10 KH: http://planmatrix.de V1.1
* 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."); }
// -------------------------------------------------------------------------------------------
 
$id = array_rand ( $content["struct"], 1 );
 
while ($content["struct"][$id]["acat_hidden"] != 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.

deutsch/ersetzer_rts/frontend_render/random-category-alias-id.1279453313.txt.gz · Last modified: 2018/06/03 18:07 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0