Snippet >> FLINX Collective >> Random FL

This snippet will take a random fanlisting in your FLINX Collective and shows it where ever you place the include. There is a version of this already on Codegrrl, but I didn’t really like it. How is this one different? It shows the title when you hover, and it also displays the fanlisting subject and links that too. Want to see what it looks like? Then just look down the right side bar of my layout. You’ll see a header that says Random Fanlisting and that is it!

First, open notepad and paste the following code. Name it random.php

<? $linkcount = 1;
include(“config.php”);
$result=mysql_query (“SELECT * FROM $table_link ORDER BY RAND() LIMIT $linkcount”);
if ($row=mysql_fetch_array($result)) {
do {
$width=$row["width"];
$height=$row["height"];
if ($width < 10){
$insert_width = “”;
} else { $insert_width=” width=\”$width\”"; }
if ($height < 10){
$insert_height = “”;
} else { $insert_height=” height=\”$height\”"; }
?>
<a href=”<?=$row["url"]?>” target=”_blank”><img border=”0″ src=”<?=$base_url?><?=$row["image"]?>” alt=”<?=$row["title"]?>” title=”<?=$row["title"]?>”<?=$insert_width?><?=$insert_height?>></a>
<center>site name: <a href=”<?=$row["url"]?>” target=”_blank”><?=$row["subject"]?></a></center>
<?
} while($row = mysql_fetch_array($result));
} else {print “There are no links in this category.”;}
?>

You load this file into your flinx directory, or whatever you have named the folder that contains all of the files for flinx collective.

Finally, you put this include wherever you want the random fanlisting to show up (note that you must know your path):

<? include (“/path/to/your/flinx/random.php”) ?>


Page Views: 54 views

Leave a Reply

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif 

CommentLuv badge