Hi,
I cannot seem to find any articles about multi level categories and sub categories in php.
I only know how to create a 1 level categories only. Does anyone know how or could point me into the right direction?
thanks in advance.
Sami
Hi,
I cannot seem to find any articles about multi level categories and sub categories in php.
I only know how to create a 1 level categories only. Does anyone know how or could point me into the right direction?
thanks in advance.
Sami
Categories of what?
A filesystem setup will work, as will a tree setup with a database, where you have a table of "folders," each of which except the root has exactly one parent referenced.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
I meant like using mkdir() to make a dir and add subdir into it.
I think it is something like this:
Top Level
- Sub1
- Sub1_1
- Sub1_2
- Sub2
- Sub3
Code:mkdir('dir/subdir');
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
I'm learning how to explain this.
Just say that I a top level category or directory and I wanted to create very very deep into that category.
Like this...
Top Level > x > xx> and etc... nn>vv
So how would you create that from a php script. thanks.
I'm so confused about even the general idea of what you are doing.
you're making folders on the site, right?
So... mkdir('a/b/c/d/e/.../z/whatever'); ?
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
With PHP5, you can:However, in earlier versions you'd have to do it one at a time:Code:mkdir('x/xx/blah/nn/vv', 0777, true);Code:$pathname = 'x/xx/blah/nn/vv'; $dirs = explode('/', $pathname); foreach($dirs as $i => $dir) mkdir(implode('/', array_slice($dirs, 0, $i + 1)));
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Oh, I didn't think of that. I was just accessing the folder, forgetting that I was creating it as that function. How silly.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Bookmarks