Strict Standards: Declaration of action_plugin_dlcount::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/dlcount/action.php on line 14

Strict Standards: Declaration of action_plugin_indexmenu::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/indexmenu/action.php on line 169

Strict Standards: Declaration of action_plugin_ipban::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/ipban/action.php on line 67

Strict Standards: Declaration of action_plugin_loglog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/loglog/action.php on line 82

Strict Standards: Declaration of action_plugin_navi::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/navi/action.php on line 46

Strict Standards: Declaration of action_plugin_uparrow::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/uparrow/action.php on line 69

Strict Standards: Declaration of action_plugin_userspagecreate::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/userspagecreate/action.php on line 97

Strict Standards: Declaration of cache_instructions::retrieveCache() should be compatible with cache::retrieveCache($clean = true) in /home/www/wiki/inc/cache.php on line 289

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/auth.php on line 312

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/actions.php on line 154
RANDOMCATEGORY_ALIAS/ID [phpwcms-HowTo:wiki]

Strict Standards: Declaration of syntax_plugin_code::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/code/syntax.php on line 41

Strict Standards: Declaration of syntax_plugin_tip::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/tip/syntax.php on line 38

RANDOMCATEGORY_ALIAS/ID

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

  • $phpwcms['allow_ext_render'] = 1;



Script:

rt_random_category_alias

<?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"] );
 
}
 
?>


  • In “$hidden_category” category IDs can be registered, which are excluded from selection. (23,56,74,12,…) do not use apostrophes!
  • If you need the id instead of the alias, please uncomment the line below ”// Output id” and comment the line below ”// Output alias”.
    Update 19.07.2010 KH: Two TAGs {RANDOMCATEGORY_ALIAS} und {RANDOMCATEGORY_ID}.


english/phpwcms_replacer_rts/frontend_render/random-category-alias-id.txt · Last modified: 2010/07/19 07:53 by Knut Heermann (flip-flop)
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

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 79