|
Posted by deko on 08/10/06 22:27
This is close.... but I need to limit the nested foreach somehow... suggestions?
$link_cats = $wpdb->get_results("SELECT wp_linkcategories.cat_id,
wp_linkcategories.cat_name,
wp_links.link_category, wp_links.link_url, wp_links.link_description,
wp_links.link_name
FROM wp_linkcategories INNER JOIN wp_links ON wp_linkcategories.cat_id =
wp_links.link_category
WHERE wp_linkcategories.cat_id != 1");
foreach ($link_cats as $link_cat)
{
$catid = $link_cat->cat_id;
?><h2>» <?php echo $link_cat->cat_name; ?></h2><?php
foreach ($link_cats as $link_cat)
{
if ($link_cat->cat_id == $catid)
{
if ($this)
{
$link = "<a href='".$link_cat->link_url;
}
elseif ($that)
{
$link = "<a href='http://www.example.com/example/example.php";
}
if ($link_cat->link_description == '0')
{
$linkdesc = "";
}
else
{
$linkdesc = "#cat".$link_cat->link_description;
}
echo "• ".$link.$linkdesc."'>".$link_cat->link_name."</a><br />";
}
}
}
Navigation:
[Reply to this message]
|