1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP question in a small code part

Discussion in 'PHP' started by versus2, Sep 5, 2005.

  1. #1
    This code is from the "Downloads" Modul in Php-Nuke (same as the Weblinks). I want that instead of showing the categories in 2 columns, it'll show only one column - Which means, Category under a category and not 2 in a row.
    What should i edit (I'm not good with php):

    function index() { 
        global $prefix, $db, $show_links_num, $module_name; 
        include("header.php"); 
        $maindownload = 0; 
        menu($maindownload); 
        echo "<br>"; 
        OpenTable(); 
        echo "<center><font class=\"title\"><b>"._DOWNLOADSMAINCAT."</b></font></center><br>"; 
        echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>"; 
        $sql = "SELECT cid, title, cdescription FROM ".$prefix."_downloads_categories WHERE parentid='0' ORDER BY title"; 
        $result = $db->sql_query($sql); 
        $count = 0; 
        while ($row = $db->sql_fetchrow($result)) { 
       $cid = $row[cid]; 
            $cid = intval(trim($cid)); 
       $title = $row[title]; 
       $cdescription = $row[cdescription]; 
       if ($show_links_num == 1) { 
           $cnumrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_downloads WHERE cid='$cid'")); 
           $cnumm = "($cnumrows)"; 
       } else { 
           $cnumm = ""; 
       } 
       echo "<td><font class=\"option\"><strong><big>&middot;</big></strong> <a href=\"modules.php?name=$module_name&d_op=viewdownload&amp;cid=$cid\"><b>$title</b></a>$cnumm</font>"; 
       categorynewdownloadgraphic($cid); 
       if ($cdescription) { 
           echo "<br><font class=\"content\">$cdescription</font><br>"; 
       } else { 
           echo "<br>"; 
       } 
       $sql2 = "SELECT cid, title FROM ".$prefix."_downloads_categories WHERE parentid='$cid' ORDER BY title LIMIT 0,3"; 
       $result2 = $db->sql_query($sql2); 
       $space = 0; 
       while ($row2 = $db->sql_fetchrow($result2)) { 
           $cid = $row2[cid]; 
           $stitle = $row2[title]; 
               if ($space>0) { 
          echo ",&nbsp;"; 
           } 
                if ($show_links_num == 1) { 
               $cnumrows2 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_downloads WHERE cid='$cid'")); 
          $cnum = " ($cnumrows2)"; 
           } else { 
          $cnumrows2 = ""; 
           } 
           echo "<font class=\"content\"><a href=\"modules.php?name=$module_name&d_op=viewdownload&amp;cid=$cid\">$stitle</a>$cnum</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>"; 
        } 
        $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_downloads")); 
        $catnum = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_categories")); 
        echo "<center><font class=\"content\">"._THEREARE." <b>$numrows</b> "._DOWNLOADS." "._AND." <b>$catnum</b> "._CATEGORIES." "._INDB."</font></center>"; 
        CloseTable(); 
        include("footer.php"); 
    }
    PHP:
    Thanks,
    E-A.
     
    versus2, Sep 5, 2005 IP
  2. Stevo

    Stevo Peon

    Messages:
    9
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hard to know for certain without being able to test it properly but try this:

    function index() { 
        global $prefix, $db, $show_links_num, $module_name; 
        include("header.php"); 
        $maindownload = 0; 
        menu($maindownload); 
        echo "<br>"; 
        OpenTable(); 
        echo "<center><font class=\"title\"><b>"._DOWNLOADSMAINCAT."</b></font></center><br>"; 
        echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\">"; 
        $sql = "SELECT cid, title, cdescription FROM ".$prefix."_downloads_categories WHERE parentid='0' ORDER BY title"; 
        $result = $db->sql_query($sql); 
        while ($row = $db->sql_fetchrow($result)) { 
       $cid = $row[cid]; 
            $cid = intval(trim($cid)); 
       $title = $row[title]; 
       $cdescription = $row[cdescription]; 
       if ($show_links_num == 1) { 
           $cnumrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_downloads WHERE cid='$cid'")); 
           $cnumm = "($cnumrows)"; 
       } else { 
           $cnumm = ""; 
       } 
       echo "<tr><td><font class=\"option\"><strong><big>&middot;</big></strong> <a href=\"modules.php?name=$module_name&d_op=viewdownload&amp;cid=$cid\"><b>$title</b></a>$cnumm</font>"; 
       categorynewdownloadgraphic($cid); 
       if ($cdescription) { 
           echo "<br><font class=\"content\">$cdescription</font><br>"; 
       } else { 
           echo "<br>"; 
       } 
       $sql2 = "SELECT cid, title FROM ".$prefix."_downloads_categories WHERE parentid='$cid' ORDER BY title LIMIT 0,3"; 
       $result2 = $db->sql_query($sql2); 
       $space = 0; 
       while ($row2 = $db->sql_fetchrow($result2)) { 
           $cid = $row2[cid]; 
           $stitle = $row2[title]; 
               if ($space>0) { 
          echo ",&nbsp;"; 
           } 
                if ($show_links_num == 1) { 
               $cnumrows2 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_downloads WHERE cid='$cid'")); 
          $cnum = " ($cnumrows2)"; 
           } else { 
          $cnumrows2 = ""; 
           } 
           echo "<font class=\"content\"><a href=\"modules.php?name=$module_name&d_op=viewdownload&amp;cid=$cid\">$stitle</a>$cnum</font>"; 
           $space++; 
       } 
       echo "</tr>"; 
        } 
       echo "</table>"; 
        $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_downloads")); 
        $catnum = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_categories")); 
        echo "<center><font class=\"content\">"._THEREARE." <b>$numrows</b> "._DOWNLOADS." "._AND." <b>$catnum</b> "._CATEGORIES." "._INDB."</font></center>"; 
        CloseTable(); 
        include("footer.php"); 
    }
    PHP:
     
    Stevo, Sep 5, 2005 IP
  3. versus2

    versus2 Well-Known Member

    Messages:
    796
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Thanks a lot Stevo ! It's working :)

    I have a problem pasting the code from here tho.. The PHP BBCode made it paste into one long line.. Any idea ?
     
    versus2, Sep 5, 2005 IP
  4. Stevo

    Stevo Peon

    Messages:
    9
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Good to hear it worked :)

    If you press the quote button under my post that'll give you the unformatted code in the message area. Just copy and paste everything between the php tags from there.
     
    Stevo, Sep 5, 2005 IP
  5. versus2

    versus2 Well-Known Member

    Messages:
    796
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    110
    #5
    Thank you very much :)
    One more little thing, i won't bother you anymore... :p
    I need this change also in another similiar module; what to change ?

    function index() {
        global $prefix, $dbi;
        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 = sql_query("select cid, title, cdescription from ".$prefix."_links_categories where parentid=0 order by title", $dbi);
        $count = 0;
        while(list($cid, $title, $cdescription) = sql_fetch_row($result, $dbi)) {
            $cid = intval($cid);
    	echo "<td><font class=\"option\"><strong><big>&middot;</big></strong> <a href=\"modules.php?name=Web_Links&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 = sql_query("select cid, title from ".$prefix."_links_categories where parentid=$cid order by title limit 0,3", $dbi);
    	$space = 0;
    	while(list($cid, $stitle) = sql_fetch_row($result2, $dbi)) {
            $cid = intval($cid);
        	    if ($space>0) {
    		echo ",&nbsp;";
    	    }
    	    echo "<font class=\"content\"><a href=\"modules.php?name=Web_Links&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>";
        }
        $result=sql_query("select * from ".$prefix."_links_links", $dbi);
        $numrows = sql_num_rows($result, $dbi);
        $result=sql_query("select * from ".$prefix."_links_categories", $dbi);
        $catnum = sql_num_rows($result, $dbi);
        echo "<br><br><center><font class=\"content\">"._THEREARE." <b>$numrows</b> "._LINKS." "._AND." <b>$catnum</b> "._CATEGORIES." "._INDB."</font></center>";
        CloseTable();
        include("footer.php");
    }
    
    PHP:
     
    versus2, Sep 5, 2005 IP
  6. Stevo

    Stevo Peon

    Messages:
    9
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    hehe this should work:

    function index() {
        global $prefix, $dbi;
        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\">";
        $result = sql_query("select cid, title, cdescription from ".$prefix."_links_categories where parentid=0 order by title", $dbi);
        while(list($cid, $title, $cdescription) = sql_fetch_row($result, $dbi)) {
            $cid = intval($cid);
    	echo "<tr><td><font class=\"option\"><strong><big>&middot;</big></strong> <a href=\"modules.php?name=Web_Links&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 = sql_query("select cid, title from ".$prefix."_links_categories where parentid=$cid order by title limit 0,3", $dbi);
    	$space = 0;
    	while(list($cid, $stitle) = sql_fetch_row($result2, $dbi)) {
            $cid = intval($cid);
        	    if ($space>0) {
    		echo ",&nbsp;";
    	    }
    	    echo "<font class=\"content\"><a href=\"modules.php?name=Web_Links&l_op=viewlink&amp;cid=$cid\">$stitle</a></font>";
    	    $space++;
    	}
    	echo "</td></tr>";
        }
        echo "</table>";
        $result=sql_query("select * from ".$prefix."_links_links", $dbi);
        $numrows = sql_num_rows($result, $dbi);
        $result=sql_query("select * from ".$prefix."_links_categories", $dbi);
        $catnum = sql_num_rows($result, $dbi);
        echo "<br><br><center><font class=\"content\">"._THEREARE." <b>$numrows</b> "._LINKS." "._AND." <b>$catnum</b> "._CATEGORIES." "._INDB."</font></center>";
        CloseTable();
        include("footer.php");
    }
    
    PHP:
     
    Stevo, Sep 5, 2005 IP
    Willy likes this.
  7. versus2

    versus2 Well-Known Member

    Messages:
    796
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    110
    #7
    It's working :) You're The Man ! Thanks a lot for your help
     
    versus2, Sep 5, 2005 IP
  8. versus2

    versus2 Well-Known Member

    Messages:
    796
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    110
    #8
    Stevo, Apperntly the sub-categories are in a different part :) please help me with that:

    
        echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>";
        $cid = intval(trim($cid));
        $result2 = sql_query("select cid, title, cdescription from ".$prefix."_links_categories where parentid=$cid order by title", $dbi);
        $count = 0;
        while(list($cid2, $title2, $cdescription2) = sql_fetch_row($result2, $dbi)) {
            $cid2 = intval(trim($cid2));
    	echo "<td><font class=\"option\"><strong><big>·</big></strong> <a href=\"modules.php?name=Web_Links&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>";
    	}
    	$result3 = sql_query("select cid, title from ".$prefix."_links_categories where parentid=$cid2 order by title limit 0,3", $dbi);
    	$space = 0;
    	while(list($cid3, $title3) = sql_fetch_row($result3, $dbi)) {
            $cid3 = intval(trim($cid3));
        	    if ($space>0) {
    		echo ",&nbsp;";
    	    }
    	    echo "<font class=\"content\"><a href=\"modules.php?name=Web_Links&l_op=viewlink&amp;cid=$cid3\">$title3</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>";
        }
    PHP:
    thanks
     
    versus2, Sep 6, 2005 IP
  9. Stevo

    Stevo Peon

    Messages:
    9
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    No problem. Try this:

    
        echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\">";
        $cid = intval(trim($cid));
        $result2 = sql_query("select cid, title, cdescription from ".$prefix."_links_categories where parentid=$cid order by title", $dbi);
        while(list($cid2, $title2, $cdescription2) = sql_fetch_row($result2, $dbi)) {
            $cid2 = intval(trim($cid2));
    	echo "<tr><td><font class=\"option\"><strong><big>·</big></strong> <a href=\"modules.php?name=Web_Links&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>";
    	}
    	$result3 = sql_query("select cid, title from ".$prefix."_links_categories where parentid=$cid2 order by title limit 0,3", $dbi);
    	$space = 0;
    	while(list($cid3, $title3) = sql_fetch_row($result3, $dbi)) {
            $cid3 = intval(trim($cid3));
        	    if ($space>0) {
    		echo ",&nbsp;";
    	    }
    	    echo "<font class=\"content\"><a href=\"modules.php?name=Web_Links&l_op=viewlink&amp;cid=$cid3\">$title3</a></font>";
    	    $space++;
    	}
    	echo "</td></tr>";
        }
        echo "</table>";
    
    PHP:
     
    Stevo, Sep 6, 2005 IP
  10. versus2

    versus2 Well-Known Member

    Messages:
    796
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    110
    #10
    Working as always :)
    thanks
     
    versus2, Sep 6, 2005 IP
  11. shah sahib

    shah sahib Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    hi

    I want to do the opposite of what stevo has done but i want to do it with the content block.

    At the moment all the catogaies are listed in row by row.

    I want 2 catogies listed per row rather that one. need help with the code

    this is the full code

    <?php

    /************************************************************************/
    /* PHP-NUKE: Web Portal System */
    /* =========================== */
    /* */
    /* Copyright (c) 2006 by Francisco Burzi */
    /* http://phpnuke.org */
    /* */
    /* This program is free software. You can redistribute it and/or modify */
    /* it under the terms of the GNU General Public License as published by */
    /* the Free Software Foundation; either version 2 of the License. */
    /************************************************************************/

    if (!defined('MODULE_FILE')) {
    die ("You can't access this file directly...");
    }

    require_once("mainfile.php");
    $module_name = basename(dirname(__FILE__));
    get_lang($module_name);

    $pagetitle = "- $module_name";

    function showpage($pid, $page=0) {
    global $prefix, $db, $sitename, $admin, $module_name;
    include("header.php");
    OpenTable();
    $pid = intval($pid);
    $mypage = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE pid='$pid'"));
    $myactive = intval($mypage['active']);
    $mytitle = filter($mypage['title'], "nohtml");
    $mysubtitle = filter($mypage['subtitle'], "nohtml");
    $mypage_header = filter($mypage['page_header']);
    $mytext = filter($mypage['text']);
    $mypage_footer = filter($mypage['page_footer']);
    $mysignature = filter($mypage['signature']);
    $mydate = $mypage['date'];
    $mycounter = intval($mypage['counter']);
    if (($myactive == 0) AND (!is_admin($admin))) {
    echo "Sorry... This page doesn't exist.";
    } else {
    $db->sql_query("UPDATE ".$prefix."_pages SET counter=counter+1 WHERE pid='$pid'");
    $date = explode(" ", $mydate);
    echo "<font class=\"title\">$mytitle</font><br>"
    ."<font class=\"content\">$mysubtitle<br><br><br><br>";
    $contentpages = explode( "[--pagebreak--]", $mytext );
    $pageno = count($contentpages);
    if ( empty($page) || $page < 1 )
    $page = 1;
    if ( $page > $pageno )
    $page = $pageno;
    $arrayelement = (int)$page;
    $arrayelement --;
    if ($pageno > 1) {
    echo ""._PAGE.": $page/$pageno<br>";
    }
    if ($page == 1) {
    echo "<p align=\"justify\">".nl2br($mypage_header)."</p><br>";
    }
    echo "<p align=\"justify\">$contentpages[$arrayelement]</p>";
    if($page >= $pageno) {
    $next_page = "";
    } else {
    $next_pagenumber = $page + 1;
    if ($page != 1) {
    $next_page .= "- ";
    }
    $next_page .= "<a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid&amp;page=$next_pagenumber\">"._NEXT." ($next_pagenumber/$pageno)</a> <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid&amp;page=$next_pagenumber\"><img src=\"images/right.gif\" border=\"0\" alt=\""._NEXT."\" title=\""._NEXT."\"></a>";
    }
    if ($page == $pageno) {
    echo "<br><p align=\"justify\">".nl2br($mypage_footer)."</p><br><br>";
    }
    if($page <= 1) {
    $previous_page = "";
    } else {
    $previous_pagenumber = $page - 1;
    $previous_page = "<a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid&amp;page=$previous_pagenumber\"><img src=\"images/left.gif\" border=\"0\" alt=\""._PREVIOUS."\" title=\""._PREVIOUS."\"></a> <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid&amp;page=$previous_pagenumber\">"._PREVIOUS." ($previous_pagenumber/$pageno)</a>";
    }
    echo "<br><br><br><center>$previous_page $next_page</center><br><br>";
    if ($page == $pageno) {
    echo "<p align=\"right\">".nl2br($mysignature)."</p>"
    ."<p align=\"right\">"._COPYRIGHT." $sitename "._COPYRIGHT2."</p>"
    ."<p align=\"right\"><font class=\"tiny\">"._PUBLISHEDON.": $date[0] ($mycounter "._READS.")</font></p>"
    ."<center>"._GOBACK."</center>";
    }
    }
    CloseTable();
    include("footer.php");
    }

    function list_pages() {
    global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file;
    include("header.php");
    title("$sitename: "._PAGESLIST."");
    OpenTable();
    echo "<center><font class=\"content\">"._LISTOFCONTENT." $sitename:</center><br><br>";
    $result = $db->sql_query("SELECT * FROM ".$prefix."_pages_categories ORDER BY title");
    $numrows = $db->sql_numrows($result);
    $numrows2 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE cid!='0' AND active='1'"));
    if ($numrows > 0 AND $numrows2 > 0) {
    echo "<center>"._CONTENTCATEGORIES."</center><br><br>"
    ."<table border=\"3\" align=\"center\" width=\"95%\">";
    while ($row = $db->sql_fetchrow($result)) {
    $cid = intval($row['cid']);
    $title = filter($row['title'], "nohtml");
    $description = filter($row['description']);
    $numrows3 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE cid='$cid'"));
    if ($numrows3 > 0) {
    echo "<tr><td valign=\"top\">&nbsp;<a href=\"modules.php?name=$module_name&amp;pa=list_pages_categories&amp;cid=$cid\">$title</a>&nbsp;</td>";
    }
    }
    echo "</td></tr></table><br><br>"
    ."<center>"._NONCLASSCONT."</center><br><br>";
    }
    $result4 = $db->sql_query("SELECT pid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='1' AND cid='0' ORDER BY date");
    echo "<blockquote>";
    while ($row4 = $db->sql_fetchrow($result4)) {
    $pid = intval($row4['pid']);
    $title = filter($row4['title'], "nohtml");
    $subtitle = filter($row4['subtitle'], "nohtml");
    $clanguage = $row4['clanguage'];
    if ($multilingual == 1) {
    $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">";
    } else {
    $the_lang = "";
    }
    if (!empty($subtitle)) {
    $subtitle = " ($subtitle)";
    } else {
    $subtitle = "";
    }
    if (is_admin($admin)) {
    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=1\">"._DEACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br>";
    } else {
    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle<br>";
    }
    }
    echo "</blockquote>";
    if (is_admin($admin)) {
    $result5 = $db->sql_query("SELECT pid, cid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='0' ORDER BY date");
    echo "<br><br><center><b>"._YOURADMINLIST."</b></center><br><br>";
    echo "<blockquote>";
    while ($row5 = $db->sql_fetchrow($result5)) {
    $pid = intval($row5['pid']);
    $cid = intval($row5['cid']);
    $title = filter($row5['title'], "nohtml");
    $subtitle = filter($row5['subtitle'], "nohtml");
    $clanguage = $row5['clanguage'];
    if ($multilingual == 1) {
    $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">";
    } else {
    $the_lang = "";
    }
    if (!empty($subtitle)) {
    $subtitle = " ($subtitle) ";
    } else {
    $subtitle = " ";
    }
    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=0\">"._ACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br>";
    }
    echo "</blockquote>";
    }
    CloseTable();
    include("footer.php");
    }

    function list_pages_categories($cid) {
    global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file;
    include("header.php");
    title("$sitename: "._PAGESLIST."");
    OpenTable();
    echo "<center><font class=\"content\">"._LISTOFCONTENT." $sitename:</center><br><br>";
    $cid = intval($cid);
    $result = $db->sql_query("SELECT pid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='1' AND cid='$cid' ORDER BY date");
    echo "<blockquote>";
    while ($row = $db->sql_fetchrow($result)) {
    $pid = intval($row['pid']);
    $title = filter($row['title'], "nohtml");
    $subtitle = filter($row['subtitle'], "nohtml");
    $clanguage = $row['clanguage'];
    if ($multilingual == 1) {
    $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">";
    } else {
    $the_lang = "";
    }
    if (!empty($subtitle)) {
    $subtitle = " ($subtitle)";
    } else {
    $subtitle = "";
    }
    if (is_admin($admin)) {
    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=1\">"._DEACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br>";
    } else {
    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle<br>";
    }
    }
    echo "</blockquote>";
    if (is_admin($admin)) {
    $result2 = $db->sql_query("SELECT pid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='0' AND cid='$cid' ORDER BY date");
    echo "<br><br><center><b>"._YOURADMINLIST."</b></center><br><br>";
    echo "<blockquote>";
    while ($row2 = $db->sql_fetchrow($result2)) {
    $pid = intval($row2['pid']);
    $title = filter($row2['title'], "nohtml");
    $subtitle = filter($row2['subtitle'], "nohtml");
    $clanguage = $row2['clanguage'];
    if ($multilingual == 1) {
    $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">";
    } else {
    $the_lang = "";
    }
    if (!empty($subtitle)) {
    $subtitle = " ($subtitle) ";
    } else {
    $subtitle = " ";
    }
    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=0\">"._ACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br>";
    }
    echo "</blockquote>";
    }
    echo "<center>"._GOBACK."</center>";
    CloseTable();
    include("footer.php");
    }

    if (!isset($page)) { $page = ""; }
    if (!isset($pa)) { $pa = ""; }

    switch($pa) {

    case "showpage":
    showpage($pid, $page);
    break;

    case "list_pages_categories":
    list_pages_categories($cid);
    break;

    default:
    list_pages();
    break;

    }

    ?>
     
    shah sahib, Aug 24, 2007 IP
  12. shah sahib

    shah sahib Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    i think this is the relevent part of the code


    function list_pages() {
    global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file;
    include("header.php");
    title("$sitename: "._PAGESLIST."");
    OpenTable();
    echo "<center><font class=\"content\">"._LISTOFCONTENT." $sitename:</center><br><br>";
    $result = $db->sql_query("SELECT * FROM ".$prefix."_pages_categories ORDER BY title");
    $numrows = $db->sql_numrows($result);
    $numrows2 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE cid!='0' AND active='1'"));
    if ($numrows > 0 AND $numrows2 > 0) {
    echo "<center>"._CONTENTCATEGORIES."</center><br><br>"
    ."<table border=\"3\" align=\"center\" width=\"95%\">";
    while ($row = $db->sql_fetchrow($result)) {
    $cid = intval($row['cid']);
    $title = filter($row['title'], "nohtml");
    $description = filter($row['description']);
    $numrows3 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE cid='$cid'"));
    if ($numrows3 > 0) {
    echo "<tr><td valign=\"top\">&nbsp;<a href=\"modules.php?name=$module_name&amp;pa=list_pages_categories&amp;cid=$cid\">$title</a>&nbsp;</td>";
    }
    }
    echo "</td></tr></table><br><br>"
    ."<center>"._NONCLASSCONT."</center><br><br>";
    }
    $result4 = $db->sql_query("SELECT pid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='1' AND cid='0' ORDER BY date");
    echo "<blockquote>";
    while ($row4 = $db->sql_fetchrow($result4)) {
    $pid = intval($row4['pid']);
    $title = filter($row4['title'], "nohtml");
    $subtitle = filter($row4['subtitle'], "nohtml");
    $clanguage = $row4['clanguage'];
    if ($multilingual == 1) {
    $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">";
    } else {
    $the_lang = "";
    }
    if (!empty($subtitle)) {
    $subtitle = " ($subtitle)";
    } else {
    $subtitle = "";
    }
    if (is_admin($admin)) {
    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=1\">"._DEACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br>";
    } else {
    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle<br>";
    }
    }
     
    shah sahib, Aug 24, 2007 IP
  13. versus2

    versus2 Well-Known Member

    Messages:
    796
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    110
    #13
    Dude :) It's a 2 years old thread.. Check the date before posting..
     
    versus2, Aug 24, 2007 IP
  14. shah sahib

    shah sahib Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    do i need to start a new thread then
     
    shah sahib, Aug 24, 2007 IP