Return to Snippet

Revision: 6746
at June 18, 2008 13:42 by _Undefined


Updated Code
<?php

//MySQL query for tags.
$tag_limit = 20;
$mysql_tags = "SELECT tags FROM entries LIMIT $tag_limit";
$mysql_qtags = mysql_query($mysql_tags) or die(mysql_error());

$tags = array();

while ($row = mysql_fetch_array($mysql_qtags)) {
	$row_tag_array = split(",", $row[0]);
	foreach ($row_tag_array as $newtag) {
		if (array_key_exists($newtag, $tags)) {
			if ($tags[$newtag] < 200) {
				$tags[$newtag] = $tags[$newtag] + 20;
			}
		}
		else {
			$tags[$newtag] = 100;
		}
	}
}

foreach ($tags as $tag => $size) {
    echo "<a style=\"font-size: $size%;\" href=\"?t=$tag\">$tag</a> "; }
?>

Revision: 6745
at June 12, 2008 10:55 by _Undefined


Updated Code
<?php

//MySQL query for tags.
$tag_limit = 20;
$mysql_tags = "SELECT tags FROM entries LIMIT $tag_limit";
$mysql_qtags = mysql_query($mysql_tags) or die(mysql_error());

$tags = array();
$sizes = array();

while ($row = mysql_fetch_array($mysql_qtags)) {
	$row_tag_array = split(",", $row[0]);
	foreach ($row_tag_array as $newtag) {
		if (array_key_exists($newtag, $tags)) {
			if ($tags[$newtag] < 200) {
				$tags[$newtag] = $tags[$newtag] + 20;
			}
		}
		else {
			$tags[$newtag] = 100;
		}
	}
}

foreach ($tags as $tag => $size) {
    echo "<a style=\"font-size: $size%;\" href=\"?t=$tag\">$tag</a> "; }
?>

Revision: 6744
at June 12, 2008 10:53 by _Undefined


Updated Code
<?php

//MySQL query for tags.
$tag_limit = 20;
$mysql_tags = "SELECT tags FROM entries LIMIT $tag_limit";
$mysql_qtags = mysql_query($mysql_tags) or die(mysql_error());

$tags = array();
$sizes = array();

while ($row = mysql_fetch_array($mysql_qtags)) {
	$row_tag_array = split(",", $row[0]);
	foreach ($row_tag_array as $newtag) {
		if (array_key_exists($newtag, $tags)) {
			if ($tags[$newtag] < 200) {
				$tags[$newtag] = $tags[$newtag] + 20;
			}
		}
		else {
			$tags[$newtag] = 200;
		}
	}
}

foreach ($tags as $tag => $size) {
    echo "<a style=\"font-size: $size%;\" href=\"?t=$tag\">$tag</a> "; }
?>

Revision: 6743
at June 12, 2008 10:53 by _Undefined


Updated Code
<?php

//MySQL query for tags.
$tag_limit = 20;
$mysql_tags = "SELECT tags FROM entries LIMIT $tag_limit";
$mysql_qtags = mysql_query($mysql_tags) or die(mysql_error());

$tags = array();
$sizes = array();

while ($row = mysql_fetch_array($mysql_qtags)) {
	$row_tag_array = split(",", $row[0]);
	foreach ($row_tag_array as $newtag) {
		if (array_key_exists($newtag, $tags)) {
			if ($tags[$newtag] <= 200) {
				$tags[$newtag] = $tags[$newtag] + 20;
			}
		}
		else {
			$tags[$newtag] = 200;
		}
	}
}

foreach ($tags as $tag => $size) {
    echo "<a style=\"font-size: $size%;\" href=\"?t=$tag\">$tag</a> "; }
?>

Revision: 6742
at June 12, 2008 10:46 by _Undefined


Initial Code
<?php

//MySQL query for tags.
$tag_limit = 20;
$mysql_tags = "SELECT tags FROM entries LIMIT $tag_limit";
$mysql_qtags = mysql_query($mysql_tags) or die(mysql_error());

$tags = array();
$sizes = array();

while ($row = mysql_fetch_array($mysql_qtags)) {
	$row_tag_array = split(",", $row[0]);
	foreach ($row_tag_array as $newtag) {
		if (array_key_exists($newtag, $tags)) {
			if ($tags[$newtag] <= 200) {
				$tags[$newtag] = $tags[$newtag] + 20;
			}
		}
		else {
			$tags[$newtag] = 100;
		}
	}
}

foreach ($tags as $tag => $size) {
    echo "<a style=\"font-size: $size%;\" href=\"?t=$tag\">$tag</a> "; }
?>

Initial URL
http://underscoreundefined.co.cc/

Initial Description
Simple tag links from a database with tags stored in a field as 'tag,tag,tag,tag'.

Initial Title
Tags based on frequency from a 'tags' field.

Initial Tags


Initial Language
PHP