{{indexmenu_n>810}}
====== RANDOMARTICLE_ALIAS/ID ======
A quite simple solution to show a random article by alias- or id and show the result at the place of the 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]]
**Author:** K.Heermann (flip-flop) http://planmatrix.de \\
**CMS Version:** >= 1.3 \\
**Version:** V1.0 \\
TAGs: {RANDOMARTICLE_ALIAS} and {RANDOMARTICLE_ID} \\
Fileiname: **rt_random_article_alias.php**
Folder: ** template/inc_script/frontend_render/ **
**Condition:** -> [[http://www.phpwcms-docu.de/config_dateien.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” article IDs can be registered, which are excluded from selection. ('23,56,74,12,…') please use apostrophes at the beginning and end!
* 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 {RANDOMARTICLE_ALIAS} and {RANDOMARTICLE_ID}.
\\