NAVIGATION
This shows you the differences between two versions of the page.
|
deutsch:ersetzer_rts:frontend_render:random-category-alias-id [2010/07/18 13:46] Knut Heermann (flip-flop) |
deutsch:ersetzer_rts:frontend_render:random-category-alias-id [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| {{indexmenu_n>810}} | {{indexmenu_n>810}} | ||
| - | ====== RANDOMCATEGORY ====== | + | ====== RANDOMCATEGORY_ALIAS/ID ====== |
| - | + | ||
| - | 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}**. | + | |
| + | Eine einfache Lösung für die zufällige Auswahl einer/s Kategorie-Alias- oder ID und der Darstellung an der Stelle der TAGs **{RANDOMCATEGORY_ALIAS}** / **{RANDOMCATEGORY_ID}**. | ||
| + | \\ | ||
| ---- | ---- | ||
| - | **rt_random_category** V1.0 18.07.10 | + | **rt_random_category_alias** V1.0 18.07.10 |
| Docu: -- \\ | Docu: -- \\ | ||
| Line 21: | Line 21: | ||
| - | Tag: {RANDOMCATEGORY} \\ | + | Tag: {RANDOMCATEGORY_ALIAS} und {RANDOMCATEGORY_ID} \\ |
| - | Dateiname: **rt_random_category.php** | + | Dateiname: **rt_random_category_alias.php** |
| Verzeichnis: ** template/inc_script/frontend_render/ ** | Verzeichnis: ** template/inc_script/frontend_render/ ** | ||
| Line 40: | Line 40: | ||
| - | <code php |h rt_random_category |h > | + | <code php |h rt_random_category_alias |h > |
| <?php | <?php | ||
| Line 47: | Line 47: | ||
| * 18.07.10 KH: http://planmatrix.de V1.0 | * 18.07.10 KH: http://planmatrix.de V1.0 | ||
| * frontend_render-Script: Random category alias/id | * frontend_render-Script: Random category alias/id | ||
| + | * Update 19.07.2010 KH: Two Tags {RANDOMCATEGORY_ALIAS} and {RANDOMCATEGORY_ID} | ||
| ********************************************************************************************* | ********************************************************************************************* | ||
| */ | */ | ||
| Line 55: | Line 56: | ||
| // ------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------- | ||
| - | $id = array_rand ( $content["struct"], 1 ); | + | if (strpos($content["all"], '{RANDOMCATEGORY_') ) { |
| - | while ($content["struct"][$id]["acat_hidden"] != 0) | + | $hidden_category = array(); // CUSTOM: All not available categories like 22,47,56,... |
| + | |||
| + | |||
| $id = array_rand ( $content["struct"], 1 ); | $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"] ); | ||
| - | // Output alias | + | } |
| - | $content["all"] = str_replace('{RANDOMCATEGORY}',$content["struct"][$id]["acat_alias"],$content["all"] ); | + | |
| - | + | ||
| - | // Output id | + | |
| - | // $content["all"] = str_replace('{RANDOMCATEGORY}',$id,$content["all"] ); | + | |
| ?> | ?> | ||
| </code> | </code> | ||
| - | |||
| - | Wenn die ID anstatt des Alias gebraucht wird, bitte die Zeile nach "%%// Output id%%" entkommentieren und die Zeile nach "%%// Output alias%%" kommentieren. | ||
| \\ | \\ | ||
| + | |||
| + | * In "$hidden_category" können Kategorie-IDs eingetragen werden, die von der Selektion ausgenommen sind. //(23,56,74,12,...) keine Hochkommata verwenden!// | ||
| + | * <del>Wenn die ID anstatt des Alias gebraucht wird, bitte die Zeile nach "%%// Output id%%" entkommentieren und die Zeile nach "%%// Output alias%%" kommentieren.</del> \\ Update 19.07.2010 KH: Zwei TAGs **{RANDOMCATEGORY_ALIAS}** und **{RANDOMCATEGORY_ID}**. | ||
| + | |||
| + | |||
| + | \\ | ||