SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
-
Jan 20, 2002, 10:11 #1
catagory listing as links and sublinks ??
hi all ..
how can i do this !?
i have 1 table :
Code:Field | Type cid | int(7) sort | int(3) sub | int(7) active | char(3) listed | char(3) name | varchar(30) link | blob
what i don`t know how to figure it , it`s to list it with this way , that at start will list just the main catagories , and when the user click on one of this will list under it the sub catagories for this main cat. some thing like this
Main1
. sub 1
. sub 1
. sub 1
Main2
main 3
.
.
etc.
so how, am trying to do this all the day with no resulet
THX ALOT FOR U HELP ..
-
Jan 20, 2002, 12:27 #2
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Jan 20, 2002, 12:49 #3
- Join Date
- Jan 2002
- Location
- Sri Lanka
- Posts
- 10
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is this what you are looking for
I'm not quite sure of what you want to do
Take a look at this page. if what happens on the left frame is what you want to do then I will upload source code
http://www.disciplers.com/chinese.html
-
Jan 21, 2002, 02:46 #4
ArjunaK ... THX alot this what i need
-
Jan 21, 2002, 03:00 #5
freddydoesphp .. i had found this code too short for u code :
PHP Code:<?
$result = mysql_query("select * from catagory order by sort");
while($row = mysql_fetch_array($result)) {
extract($row); //loads the array $row into variables for each column(id becomes $id)
//same as $id=$row["ID"]; for each column
if($sub == 0) { //If the parent id is 0 then this is a main cat
$tcats[$cid][] = array("cid" => $cid,
"name" => $name,
"sub" => $sub);
}
else { //Or else this is a subcat
$tcats[$sub][] = array("cid" => $cid,
"name" => $name,
"sub" => $sub);
}
}
foreach($tcats as $key => $val) {
if(is_array($tcats[$key])) {
foreach($tcats[$key] as $jey => $jal) {
if($tcats[$key][$jey]['sub'] == 0) {
$this_link="?menu=sub&cid=".$tcats[$key][$jey]['cid']."&sub=".$tcats[$key][$jey]['sub']."" ;
?>
. <a href ="<?=$this_link?>"><?=$tcats[$key][$jey]['name']?></a><br>
<?}
if($menu=="sub"){
if($tcats[$key][$jey]['sub'] != 0) {
$this_sub_link="?cid=".$tcats[$key][$jey]['cid']."&sub=".$tcats[$key][$jey]['sub']."" ;
?>
- <a href ="<?=$this_sub_link?>"><?=$tcats[$key][$jey]['name']?></a><br>
<?}
}
}
}
}
?>
something link what ArjunaK had done .
-
Jan 21, 2002, 11:20 #6
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
No it doesn't close the sublink when not active, but the great thing about it is, its a class and it get be extended without too much effort to do what you need.
Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Jan 21, 2002, 15:39 #7
- Join Date
- Jan 2002
- Location
- Sri Lanka
- Posts
- 10
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ok I've got the code in a Zip but I cant figure out how to upload it
Arjuna
-
Jan 22, 2002, 02:21 #8
ArjunaK
would u please ur PM ...
-
Jan 22, 2002, 02:35 #9
i got ur email .. thx alot again, i`ll check it now !
Bookmarks