Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
jlmfaf
New Member
New Member



Joined: Sep 01, 2006
Posts: 13
Location: Charleston SC USA

PostPosted: Sun Sep 10, 2006 9:37 pm Reply with quote

Just a quick question.. the descriptions for the sub categories for the web links module don't display..

Whats the purpose of having a description if they don't display?

I guess I'm kinda being lazy.. as I can just look closer at the 'main-category' part of the index file to figure it out.. i'm just posting this before I hit the sack..

If anyone has the time and needs something to do.. I'd like to know what string needs to be in the sub-category display..

and also.. I'd like when pulling up the sub category or looking inside the sub-category..

That the "Description" for the category being viewed is redescribed as it was on the first page of viewing all the categories..

So I have the web links module and it has categories with descriptions.. I click a category.. it lists sub-categories w/ their descriptions and also relists the main category's description back up top..

so forth and so on..
 
View user's profile Send private message
jlmfaf







PostPosted: Mon Sep 11, 2006 5:44 pm Reply with quote

Ok so here's the part of the code that you would see inside the index.php file for your Web Links module, or atleast.. this is part of it. The part that displays the main categories.. the cdescription code is obviously where the description for that category is displayed..

Code:
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."_wine_categories where parentid=0 order by title");
    $dum = 0;
    $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=Wine&amp;l_op=viewlink&amp;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."_wine_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=Wine&amp;l_op=viewlink&amp;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."_wine_links");
    $numrows = $db->sql_numrows($result3);
    $result4 = $db->sql_query("SELECT * from ".$prefix."_wine_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");
}


Finding that was easy.. fell into my lap at the beginning of the code.. however finding the subcategory listing isn't nearly as easy.. I then found the function for when your looking at a subcategory OR specific link..

"function viewlink"

Code:
    OpenTable();

    $cid = intval($cid);
    $row_two = $db->sql_fetchrow($db->sql_query("SELECT title,parentid FROM ".$prefix."_wine_categories WHERE cid='$cid'"));
   $title = stripslashes(check_html($row_two['title'], "nohtml"));
   $parentid = intval($row_two['parentid']);
   $title=getparentlink($parentid,$title);
   $title="<a href=modules.php?name=$module_name>"._MAIN."</a>/$title";
    echo "<center><font class=\"option\"><b>"._CATEGORY.": $title</b></font></center><br>";
    echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>";
    $cid = intval($cid);
    $result2 = $db->sql_query("SELECT cid, title, cdescription from ".$prefix."_wine_categories where parentid='$cid' order by title");
    $dum = 0;
    $count = 0;
    while($row2 = $db->sql_fetchrow($result2)) {
        $cid2 = intval($row2['cid']);
        $title2 = stripslashes(check_html($row2['title'], "nohtml"));
        $cdescription2 = stripslashes($row2['cdescription']);
   echo "<td><font class=\"option\"><strong><big>&middot;</big></strong> <a href=\"modules.php?name=Wine&amp;l_op=viewlink&amp;cid=$cid2\"><b>$title2</b></a></font>";
   categorynewlinkgraphic($cid2);
   if ($description) {
       echo "<font class=\"content\">$cdescription2</font><br>";
   } else {
       echo "<br>";
   }


So.. the code is there

But why isn't it kicking in as it should? I double checked the tables in MySQL.. they are there descriptions and all..

Any ideas?

(FYI, you might wonder why all over yours says _links_**.. I copied the module for a new purpose)
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Tue Sep 12, 2006 5:58 am Reply with quote

Yes, I have always found that 'odd', but never really cared that much for the Web Links module anyways...

You could try changing the following lines:

if ($description) {
echo "<font class=\"content\">$cdescription2</font><br>";
} else {
echo "<br>";
}

to:

// if ($description) {
echo "<font class=\"content\">$cdescription2</font><br>";
// } else {
// echo "<br>";
// }

I have not tested this, so make sure it does what you want and does not break anything else within the module.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
jlmfaf







PostPosted: Tue Sep 12, 2006 11:26 am Reply with quote

Wonderful! that worked.. thanks!

Maybe they could slide that into an update somewhere along the way..
 
montego







PostPosted: Wed Sep 13, 2006 5:54 am Reply with quote

Quote:

Maybe they could slide that into an update somewhere along the way..

If who you mean by "they" is the author of PHP-Nuke, good luck...
 
jlmfaf







PostPosted: Wed Sep 13, 2006 10:19 am Reply with quote

Nah, can't expect that.. I mean the dev's of RN.. Smile
 
montego







PostPosted: Thu Sep 14, 2006 5:47 am Reply with quote

Got it! I have added it for future consideration.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
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 can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©