Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,253
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamically generating a site menu

    Hi all,

    my PHP knowledge is still in it's infancy, so to get some practice I thought it would be nice to figure out a way to dynamically serve up a basic site menu using an included PHP script; I'm just trying to get my head around how to approach this.

    Basically, I'd like to generate a simple, texted based menu, controlled by (a) variable(s) included in the page it's showing on; the menu I'm envisaging has multiple (about 3 or 4) levels and for every page, only the first level menu choices and all parent levels of the page shown should be visible.

    For a first version, an array to hold the necessary info on the menu would more than suffice; if needed, I think I would be capable to convert to using a table lateron.

    I've been searching this forum, but nothing useful came up; if anyone can point me to some useful info, an example of something similar, a relevant thread I've missed while searching, or any thoughts on the basic approach, I'm looking forward to it.
    I'm not after a full working cut-n-paste solution, just something to get me started.

    Thanks in advance.
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Iran
    Posts
    695
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your post is not that clear, are you trying to print out some links that resemble a menu? Or do you want to give it some effects like opening/closing? So, for the latter you have to use Javascript and if you know how to make such thing in JS, then it's very easy to make the JS arrays that hold the info with PHP and then let the JS functions work for themselves. What sort of tutorial are you looking for? Do you know how to work with arrays in PHP? If yes, then I don't think that any tutorial is needed in here. I'm confused again


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •