Help with modifying a code

Discussion in 'Programming' started by shah sahib, Aug 24, 2007.

  1. #1
    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



    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");
    }
     
    shah sahib, Aug 24, 2007 IP
  2. Tarkan

    Tarkan Peon

    Messages:
    491
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The code is very messy, but I would assume you can edit this line:
    <td valign=\"top\">&nbsp;<a href=\"modules.php?name=$module_name&amp;pa=list_pages_categories&amp;cid=$cid\">$title</a>&nbsp;</td>

    By adding a new category in that ROW a tr being a table row.
     
    Tarkan, Aug 24, 2007 IP