Hello, I'm working on a content management system called JakeSys (Click for demo). If you look at the files system, you can see that it's just post a file and it lists all the files along with a menu to rate them, download count, etc.
I want to make the system hierarchal but I have no idea how. For example, if I made a system to download web development tools. I could have sections like "Graphics", "PHP Scripts". And then in graphics I'd have "Free Templates", "Free Logos", and in php scripts I would have different categories of php scripts, and then in each category, I would have the actual scripts. I want to be able to add / delete / edit categories and files though.
My files table (js_files) has these values:
id (increasing int), name (text), description (text), downloads (int), author (text), poster (text), date (text), rating (int), rating_votes (int), url (text).
I don't know whether it will need multiple tables or what.
Thanks,
Hierarchal Files System
Moderator: General Moderators
Code: Select all
<select name="cat_id" id="cat_id">
<option value="0" selected>/</option>
<?
$sql=mysql_query("SELECT * from js_filestruct");
while($r=mysql_fetch_array($sql)){
$cat_pid=$r["parent_id"];
$cat_path=$r["name"] . "/";
while($cat_pid!=0){
$sql2=mysql_query("SELECT * from js_filestruct where id='{$cat_pid}'");
$r2=mysql_fetch_array($sql2);
$cat_pid=$r2["parent_id"];
$cat_path=$r2["name"] . "/" . $cat_path;
}
echo "<option value="" . $r["id"] . "">/" . $cat_path . "</option>\n";
}
?>
</select>