...

View Full Version : Categories Page



stevenmw
08-23-2009, 04:35 AM
I'm working on something similar to a news system. I've got a database table storing a list of categories.

Ifs any one knows where I can find a tutorial, or can just plain help that'd be amazing.


I'm trying to build a page that generates a list of articles under one category. Each time a category link is clicked they are taken to this page, and only articles under the clicked category are visible.

I've written a display file that checks a single category, and displays it. I'm trying to make a display that works for all categories....

seco
08-23-2009, 04:43 AM
http://www.hotscripts.com

funnymoney
08-23-2009, 08:36 AM
I've written a display file that checks a single category, and displays it. I'm trying to make a display that works for all categories....

If you can post your code maybe we could help you more.

Usually links are accessed by $_GET or $_POST PHP predefined variables. $_GET variable, for example, is set when you click on link that looks something like this



<a href="index.php?category=home">Home</a>
<a href="index.php?category=about-us">About Us</a>
<a href="index.php?category=contact">Contact</a>


When you click on that link you index.php with code below should display info based on the link you clicked



if (isset($_GET['category'])) {
switch ($_GET['category']) {
case "home":
$page = "home";
break;
case "about-us":
$page = "about-us";
break;
case "contact":
$page = "contact";
break;
default:
$page = "home";
break;
}
}
else {
$page = "home";
}

print $page;


now you can use $page variable to display different categories based on $page value



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum