Web_Links Module Help!

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Web_Links Module Help!
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Hello Telli,

I noticed your web links module shows how many links are in each category!
[ Register or login to view links on this board. ]

example: Javascripts (6)

I would like to display this as well, could you help me out?

xtrax2 icon_biggrin.gif



Back to top Reply with quote
#2   re: Web_Links Module Help!
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Ok does anyone know how to achieve this?



Back to top Reply with quote
#3   
westerner
CZ Newbie
 Codezwiz Site Donator
usa.gif wisconsin.gif
Age: 47
Gender: Male
Status: Offline
Joined: Jul 15, 2003
0.00 posts per day
Posts: 4
Points: 741
   
The easiest way is to select the number of links from each category.


SELECT c.`cid`, c.`title`, c.`cdescription`, (SELECT COUNT(`lid`) FROM `nuke_links_links` WHERE `cid` = c.`cid`) AS numincat FROM `nuke_links_links`



Back to top Reply with quote
#4   re: Web_Links Module Help!
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Ok I tried your above code and I still cant seem to get it too work...

This is what I have


$thenum = $db->sql_numrows($db->sql_query("SELECT c.`cid`, c.`title`, c.`cdescription`, (SELECT COUNT(`lid`) FROM `nuke_links_links` WHERE `cid` = c.`cid`) AS thenum FROM `nuke_links_links`"));


Any suggestions?

xtrax1


Back to top Reply with quote
#5   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
That query will get all the info for the index page not just the number in each category.


$result = $db->sql_query("SELECT c.`cid`, c.`title`, c.`cdescription`, (SELECT COUNT(`lid`) FROM `nuke_links_links` WHERE `cid` = c.`cid`) AS thenum FROM `nuke_links_links`");
while($row = $db->sql_fetchrow($result)) {
   echo $row['title'] . ' ' . $row['thenum'];
}




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#6   re: Web_Links Module Help!
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Hello Telli,

Thank you for replying.... however I added that code to my standard web links module and it still isnt showing anything....

Maybe I am not being clear enough which I appoligize for

I am tring to accomplish what you have done in your web links section by displaying the number of links listed in each category....

I am using the standard Web Links module and this is my function index ()...

function index() {
    global $prefix, $db;
    include("header.php");
    $mainlink = 0;
    menu($mainlink);
    echo "<br>";
    OpenTable();
    echo "<center><font class=\"title\"><b>"._LINKSMAINCAT."</b></font></center><br>";
    echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>";
    $result = $db->sql_query("select cid, title, cdescription from ".$prefix."_links_categories where parentid=0 order by title");
    $count = 0;
    while ($row = $db->sql_fetchrow($result)) {
   $cid = intval($row['cid']);
   $title = stripslashes(check_html($row['title'], "nohtml"));
   $cdescription = stripslashes($row['cdescription']);
   echo "<td><font class=\"option\"><strong><big>&middot;</big></strong> <a href=\"modules.php?name=Web_Links&l_op=viewlink&cid=$cid\"><b>$title</b></a></font>";
   categorynewlinkgraphic($cid);
   if ($cdescription) {
       echo "<br><font class=\"content\">$cdescription</font><br>";
   } else {
       echo "<br>";
   }
   $result2 = $db->sql_query("SELECT cid, title from ".$prefix."_links_categories where parentid='$cid' order by title limit 0,3");
   $space = 0;
   while ($row2 = $db->sql_fetchrow($result2)) {
       $cid = intval($row2['cid']);
       $stitle = stripslashes(check_html($row2['title'], "nohtml"));
           if ($space>0) {
      echo ",&nbsp;";
       }
       echo "<font class=\"content\"><a href=\"modules.php?name=Web_Links&l_op=viewlink&cid=$cid\">$stitle</a></font>";
       $space++;
   }
   if ($count<1) {
       echo "</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td>";
       $dum = 1;
   }
   $count++;
   if ($count==2) {
       echo "</td></tr><tr>";
       $count = 0;
       $dum = 0;
   }
    }
    if ($dum == 1) {
   echo "</tr></table>";
    } elseif ($dum == 0) {
   echo "<td></td></tr></table>";
    }
    $result3 = $db->sql_query("SELECT * from ".$prefix."_links_links");
    $numrows = $db->sql_numrows($result3);
    $result4 = $db->sql_query("SELECT * from ".$prefix."_links_categories");
    $catnum = $db->sql_numrows($result4);
    $numrows = intval($numrows);
    $catnum = intval($catnum);
    echo "<br><br><center><font class=\"content\">"._THEREARE." <b>$numrows</b> "._LINKS." "._AND." <b>$catnum</b> "._CATEGORIES." "._INDB."</font></center>";
    CloseTable();
    include("footer.php");
}


I hope this helps as I have tried everything...

xtrax1


Back to top Reply with quote
#7   re: Web_Links Module Help!
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   

function index() {
   global $prefix, $db;
   include("header.php");
   $mainlink=0;
   menu($mainlink);
   echo "<br>";
   OpenTable();
   echo "<center><font class=\"title\"><b>"._LINKSMAINCAT."</b></font></center><br>";
   echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>";
   $result = $db->sql_query("SELECT c.`cid`, c.`title`, c.`cdescription`, (SELECT COUNT(`lid`) FROM `".$prefix."_links_links` WHERE `cid` = c.`cid`) AS thenum FROM ".$prefix."_links_categories c where c.`parentid` = 0 ORDER BY c.`title`");
   $count = 0;
   while ($row = $db->sql_fetchrow($result)) {
      $cid = intval($row['cid']);
      $title = stripslashes(check_html($row['title'], "nohtml"));
      $cdescription = stripslashes($row['cdescription']);
      echo "<td><font class=\"option\"><strong><big>&middot;</big></strong> <a href=\"modules.php?name=Web_Links&l_op=viewlink&cid=$cid\"><b>$title</b></a> (".(int)$row['thenum'].")</font>";
         categorynewlinkgraphic($cid);
      if ($cdescription) {
         echo "<br><font class=\"content\">$cdescription</font><br>";
      } else {
         echo "<br>";
      }
      $result2 = $db->sql_query("SELECT c.`cid`, c.`title`, (SELECT COUNT(`lid`) FROM `".$prefix."_links_links` WHERE `cid` = c.`cid`) AS thenum FROM ".$prefix."_links_categories c where c.`parentid` = $cid ORDER BY c.`title` LIMIT 0,3");
      $space = 0;
      while ($row2 = $db->sql_fetchrow($result2)) {
         $cid = intval($row2['cid']);
         $stitle = stripslashes(check_html($row2['title'], "nohtml"));
         if ($space>0) {
            echo ",&nbsp;";
         }
         echo "<font class=\"content\"><a href=\"modules.php?name=Web_Links&l_op=viewlink&cid=$cid\">$stitle</a> (".(int)$row2['thenum'].")</font>";
         $space++;
      }
      if ($count<1) {
         echo "</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td>";
         $dum = 1;
      }
      $count++;
      if ($count==2) {
         echo "</td></tr><tr>";
         $count = 0;
         $dum = 0;
      }
   }
   if ($dum == 1) {
      echo "</tr></table>";
   } elseif ($dum == 0) {
      echo "<td></td></tr></table>";
   }
   $result3 = $db->sql_query("SELECT * from ".$prefix."_links_links");
   $numrows = $db->sql_numrows($result3);
   $result4 = $db->sql_query("SELECT * from ".$prefix."_links_categories");
   $catnum = $db->sql_numrows($result4);
   $numrows = intval($numrows);
   $catnum = intval($catnum);
   echo "<br><br><center><font class=\"content\">"._THEREARE." <b>$numrows</b> "._LINKS." "._AND." <b>$catnum</b> "._CATEGORIES." "._INDB."</font></center>";
   CloseTable();
   include("footer.php");
}




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#8   re: Web_Links Module Help!
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Hello Telli,

Ok I repleaced my entire function index(); with the one you modified for me and it still a no go...

Now there are no categories displaying or anything....???

So when I looked at your code I can easily see the c.title instead of title so for giggles I tried removing the c.'title' and the rest that had c. in front of them and then the categories re-appear but the num count still dont work...

If it has c.title or c.cid it dont work at all

Any ideas?



Back to top Reply with quote
#9   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
Try grabbing the above code again. I made a couple changes.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#10   re: Web_Links Module Help!
xtrax1
CZ Active Member
 Codezwiz Site Donator
xtrax1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Feb 18, 2005
0.01 posts per day
Posts: 107
Points: 3,824
   
Hello Telli,

That did it your the man, thank you so much!

I will send a donate for your help....

ttyl.

xtrax icon_biggrin.gif



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum