{{indexmenu_n>800}} ====== RANDOMCP ====== FIXME übersetzen Zeigt einen zufällig ausgewählten Content Part aus einem vorgewählten Artikel (Du gibtst die Artikel-ID in den Ersetzer ein - es wird ein Zufallsinhaltsabschnitt aus dem Artikel angezeigt. Simpel, nicht wahr?) AUTHOR: Jens Zetterström \\ ===== INSTALLATION: ===== Put the code in **/frontend_render/** (for example in a file called **random_cp.php**). If the article content part contains replacement tags (for example {SITE}), they will not be replaced because code in /frontend_render/ is executed after those replacement tags already have been processed. To fix, put the code in content.article.inc.php instead. ==== USAGE: ==== **{RANDOMCP:article_id}** //(article_id ist die ID des ARTIKELS).// ==== RCS: ==== Setze den Artikel auf "unsichtbar", die Content Parts jedoch auf "sichtbar" NOW() "; "ORDER BY RAND()"; if($cresult = mysql_query($sql, $db) or die("error retrieving article from database")) { if($crow = mysql_fetch_array($cresult)) { //echo "
";print_r($crow);echo"
"; // Space before if($crow["acontent_before"]) { $CNT_TMP .= '
'; } // include content part code section include("include/inc_front/content/cnt" . $crow["acontent_type"] . ".article.inc.php"); //check if top link should be shown if($crow["acontent_top"]) { if($template_default["article"]["top_sign_before"].$template_default["article"]["top_sign_after"]) { $CNT_TMP .= $template_default["article"]["top_sign_before"]; $CNT_TMP .= ''.$template_default["article"]["top_sign"].''; $CNT_TMP .= $template_default["article"]["top_sign_after"]; } else { $CNT_TMP .= '
' . $template_default["article"]["top_sign"] . ''; } } // Space after if($crow["acontent_after"]) { $CNT_TMP .= '
'; } } } return $CNT_TMP; } if( ! ( strpos($content["all"],'{RANDOMCP:')===false ) ) { $content["all"] = preg_replace('/\{RANDOMCP:(.*?)\}/ie', 'random_cp("$1", $db);', $content["all"]); //$content["all"] = (psTagParser ($content["all"])); // RCS commented 03.11.08 } ?>