{{indexmenu_n>810}}
====== RANDOMARTICLE_ALIAS/ID ======
Eine einfache Lösung für die zufällige Auswahl einer/s Artikel-Alias- oder id und der Darstellung an der Stelle der TAGs **{RANDOMARTICLE_ALIAS}** / **{RANDOMARTICLE_ID}**.
\\
----
**rt_random_article_alias** 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 \\
TAGs: {RANDOMARTICLE_ALIAS} und {RANDOMARTICLE_ID} \\
Dateiname: **rt_random_article_alias.php**
Verzeichnis: ** template/inc_script/frontend_render/ **
**Bedingung:** -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\
* $phpwcms['allow_ext_render'] = 1;
----
----
\\
===== Script: =====
NOW()) ";
$sql .= (!empty($hidden_article))? "AND article_id NOT IN (".$hidden_article.") ":'';
$sql .= "ORDER BY RAND() LIMIT 0,1";
$result = _dbQuery($sql);
if (!$content["struct"][$result['0']['article_cid']]['acat_regonly']) $c = 1; // Break if the category is free for all
} // --- END while
// Output alias
$content["all"] = str_replace('{RANDOMARTICLE_ALIAS}',$result['0']['article_alias'],$content["all"] );
// Output id
$content["all"] = str_replace('{RANDOMARTICLE_ID}',$result['0']['article_id'],$content["all"] );
}
?>
\\
* In "$hidden_article" können Artikel-IDs eingetragen werden, die von der Selektion ausgenommen sind. //('23,56,74,12,...') Hochkommata am Anfang und Ende verwenden!//
* Wenn die ID anstatt des Alias gebraucht wird, bitte die Zeile nach "%%// Output id%%" entkommentieren und die Zeile nach "%%// Output alias%%" kommentieren. \\
**Update 19.07.2010 KH:** Zwei TAGs {RANDOMARTICLE_ALIAS} und {RANDOMARTICLE_ID}.
\\