Current location: Hot Scripts Forums » Programming Languages » PHP » General question re setting up navigation system...


General question re setting up navigation system...

Reply
  #1 (permalink)  
Old 08-31-05, 05:13 PM
mixermanic mixermanic is offline
Newbie Coder
 
Join Date: Aug 2003
Location: London UK
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
General question re setting up navigation system...

Hi everybody,

I'm (reasonably) new to PHP coding, and am setting up a heirachical website where the base file is "index.php". I will be navigating by index.php?page=foo (although OT I will probably be using .htaccess to clean that up a bit )

As it is a small site I see no point in using a MySQL database, so I would like to include a "structure.php" file at the top of every page with the information in it. I am planning to use arrays to store the info:

PHP Code:

$siteStructure = array(


    
"0" => array(
        
pID => "-1"
        
URL => "index",
        
pageName => "Index",
        
includeContent => "idx.inc"
        
),

        
"1" => array(
            
pID => "0"
            
URL => "sect1",
            
pageName => "Section 1",
            
includeContent => "s1.inc"
            
),

            
"2" => array(
                
pID => "1"
                
URL => "sect1sub1",
                
pageName => "Subsection 1",
                
includeContent => "s1_ss1.inc"
                
),

            
"3" => array(
                
pID => "1"
                
URL => "sect1sub2",
                
pageName => "Subsection 2",
                
includeContent => "s1_ss2.inc"
                
),

        
"4" => array(
            
pID => "0"
            
URL => "sect2",
            
pageName => "Section 2",
            
includeContent => "s2.inc"
            
)

); 
etc, basically creating a nodal struture, where the keys of the outer array are the uID's of the page, and the pID key is the parent ID. This will (hopefully) let me easily do breadcrumbs / navigation menus.

The pageName will be used for the navigation elements, <h1> and in <title> etc. the URL key is the "foo" in index.php?page=foo.

It does have the drawback that (as far as I can see) I can't add pages in without re-numbering everything.

OK, so my questions are:
1) am I correct so far, and
2) is this the best way of doing things?

I want to use the milonic DHTML menu (http://www.milonic.com) and dtree (http://www.destroydrop.com/dtree) and have the elements of these dynamically created, so I need something I can relatively easily recurse through to get the complete structure.

Thanks!

Martin

Last edited by mixermanic; 08-31-05 at 05:15 PM. Reason: missed something :)
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
navigation system like programmingtalk phizzlecom JavaScript 2 07-03-05 11:43 AM
general question about php and html timfoster PHP 3 05-17-04 12:29 PM
General php question for the xperts themanmathias PHP 1 04-12-04 02:47 PM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 06:02 AM
general question delerium PHP 3 01-12-04 04:11 AM


All times are GMT -5. The time now is 07:05 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.