Witam zrobiłem sobie FAQ w dwóch kolumnach o to kod pliku faq.php
UWAGA!!!
zamiast faq wpisałem slownik reszta bez zmian tak jak w pliku FAQ.
KOD:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: slownik.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."slownik.php";
add_to_title($locale['global_205']);
if (!isset($_GET['cat_id']) || !isnum($_GET['cat_id'])) {
opentable($locale['400']);
echo "<!--pre_slownik_idx-->";
$result = dbquery("SELECT * FROM ".DB_SLOWNIK_CATS." ORDER BY slownik_cat_name");
$rows = dbrows($result);
if ($rows) {
$columns = 1; $counter = 0;
echo "<table cellpadding='0' cellspacing='0' width='100%' class='tbl'>\n<tr>\n";
while($data = dbarray($result)) {
if ($counter != 0 && ($counter % $columns == 0)) { echo "</tr>\n<tr>\n"; }
$num = dbcount("(slownik_id)", DB_SLOWNIKS, "slownik_cat_id='".$data['slownik_cat_id']."'");
echo "<td valign='top' class='slownik_idx_cat_name'><!--slownik_idx_cat_name--><a href='".FUSION_SELF."?cat_id=".$data['slownik_cat_id']."'>".$data['slownik_cat_name']."</a> <span class='small2'>($num)</span>\n";
if ($data['slownik_cat_description']) { echo "<br />\n<span class='small'>".$data['slownik_cat_description']."</span>"; }
echo "</td>\n";
echo "<td align='right' valign='top' class='slownik_idx_cat_name'><!--slownik_idx_cat_name--><a href='".FUSION_SELF."?cat_id=".$data['slownik_cat_id']."'>".$data['slownik_cat_name']."</a> <span class='small2'>($num)</span>\n";
if ($data['slownik_cat_description']) { echo "<br />\n<span class='small'>".$data['slownik_cat_description']."</span>"; }
echo "</td>\n";
$counter++;
}
echo "</tr>\n</table>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['410']."<br /><br />\n</div>\n";
}
echo "<!--sub_slownik_idx-->";
closetable();
} else {
if ($data = dbarray(dbquery("SELECT * FROM ".DB_SLOWNIK_CATS." WHERE slownik_cat_id='".$_GET['cat_id']."'"))) {
add_to_title($locale['global_201'].$data['slownik_cat_name']);
opentable($locale['401'].": ".$data['slownik_cat_name']);
echo "<!--pre_slownik_cat-->";
$rows = dbcount("(slownik_id)", DB_SLOWNIKS, "slownik_cat_id='".$_GET['cat_id']."'");
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
if ($rows != 0) {
$result = dbquery("SELECT * FROM ".DB_SLOWNIKS." WHERE slownik_cat_id='".$_GET['cat_id']."' ORDER BY slownik_id LIMIT ".$_GET['rowstart'].",15");
$numrows = dbrows($result);
$i = 1;
while ($data = dbarray($result)) {
echo "<strong>".$data['slownik_question']."</strong><br />\n".nl2br(stripslashes($data['slownik_answer']));
echo ($i != $numrows ? "<br /><br />\n" : "\n");
$i++;
}
echo "<!--sub_slownik_cat-->";
closetable();
if ($rows != 0) { echo "<div align='center' style='margin-top:5px;'>".makepagenav($_GET['rowstart'], 15, $rows, 3, FUSION_SELF."?cat_id=".$_GET['cat_id']."&")."\n</div>\n"; }
} else {
echo $locale['411']."\n";
echo "<!--sub_slownik_cat-->";
closetable();
}
} else {
redirect(FUSION_SELF);
}
}
require_once THEMES."templates/footer.php";
?>
I teraz chcę zrobić tak aby w jednej kolumnie były kategorie o numerach ID=1 ID=3 ID=5 itd(czyli nie parzyste) a w drugiej kolumnie ID=2 ID=4 ID=6 itd(czyli parzyste)
Zdjęcie :
Proszę o pomoc :) |