Forums Archive Index > SmartMenus 5 > database driven menu
Date: 8 Sep 2004 6:17 am
plz help me in creating a database driven menu. i'm creating my site in php, mysql. so if anybody have done such a menu then please help me.
Date: 8 Sep 2004 3:40 pm
Well, I know some guys who are pulling the content for their menus from database. If you want, I can give you their contacts and you can get in touch with them. But I can't tell whether they will be willing to help you.. :?
Date: 10 Sep 2004 8:16 am
yes sure.. plz give me their contacts. Actually I have tried with php but it don't drop down. it works fine if i run it inividualy but it won't work properly when i integrate it with my site.
thanx.
smartmenus wrote:
Well, I know some guys who are pulling the content for their menus from database. If you want, I can give you their contacts and you can get in touch with them. But I can't tell whether they will be willing to help you.. :?
Date: 23 Sep 2004 4:54 pm
kiranonline, did you get your database driven menu working? I have one working with PHP/MySQL - I was so excited that I almost forgot to buy another license for the site in question! That's taken care of now so I might be able to tell you what I did to get it working, in case the others haven't been willing to help. This is such a great menu system - fast and clean, maybe I can give something back.
Date: 24 Sep 2004 5:03 am
yes please give me that... but I want something that works fine on MAC os.
if u have such code then please help me... :!:
Loon wrote:
kiranonline, did you get your database driven menu working? I have one working with PHP/MySQL - I was so excited that I almost forgot to buy another license for the site in question! That's taken care of now so I might be able to tell you what I did to get it working, in case the others haven't been willing to help. This is such a great menu system - fast and clean, maybe I can give something back.
Date: 24 Sep 2004 7:41 am
I'll put together some instructions. I have a Mac with OS 9.1 and OS X and everything works fine except the older IE 4.5 browser. I've found no problems with Mozilla, Netscape, Safari or IE on Mac, Linux, Win2k and WinXP. (see the compatibility chart --> http://www.smartmenus.org/compatibility.php )
The horizontal menu in IE 4.5 does not drop down, but allows you to click on the main menu item. Because of the way the site is designed that uses the horizontal menu, this works fine.
I've implemented a vertical menu based on some instructions found in this forum and it gets an error in IE 4.5 and does not work yet. All other browsers are fine. This is the database driven menu.
I'll post what I did as soon as I can get it written up.
Date: 24 Sep 2004 5:59 pm
Yep, IE4.5/Mac unfortunately has just too buggy rendering engine :( The latest version of the script (e.g. v5.2) includes some changes in the styling code for the menus and I suppose the problems in IE4.5 have become even worse. :?
Anyway, the good news is that this browser is one of the rarest nowadays. :)
Date: 24 Sep 2004 6:12 pm
Agreed. We have to sort of draw the line somewhere and IE 4.5 for the Mac is Really Really old. There are a number of browsers that run fine (Netscape 4.7 on that platform has no issues that I've found) so -- sorry, but I gave up on that one! Since it sounds like there will be no more IE browsers for Mac, I appear to not be the first to give up!
We've ordered our second license and probably more to come because this is so compact and fast, easy to customize and now that I have it db driven, even better! Thanks to your great examples for dragonarmy.com, getting the menu vertical vs. horizontal was easy.
I'm working on the db driven instructions but keep getting sidetracked by customers wanting stuff. Soon --
Jean
classicwebdesign.com
Date: 2 Nov 2004 1:33 pm
Hey Loon
Have you put together the instructions yet for your PHP/MySQL driven menus? I'd be interested.
Date: 2 Nov 2004 1:48 pm
Hi - sorry I didn't get the instructions all done yet. I ran into a problem with Netscape 4.x and trying to decide if I care! The code is basically a php file that 'rewrites' the JS code and Netscape 4.x doesn't like that. It's been documented elsewhere so I suspect there isn't a fix for it.
I'll go back to the document I started and try to complete it, just so you know that the older Netscape browsers aren't functional.
Date: 2 Nov 2004 5:28 pm
Better late than never, here it is. I intend to go back to the Netscape 4.x problem and Vasil, if you see this, the error is documented in my instructions. Anyone that knows Javascript better might have a solution.
--> http://www.classicwebdesign.com/articles/DB_driven_Smartmenus.pdf
Date: 4 Nov 2004 11:52 am
Loon, these are excellent instructions! :D
I think they will be helpful for many users in the future. Thank you so much for the efforts and time you've spent and for sharing your personal experience with all the other SmartMenus users! If you don't mind, I will create a new sticky post in the next few days with a link to your instructions.
However, first I would really like to try to figure out whether the Netscape 4.x problem can be solved. Although this browser is already very very old and I plan to limit the support for it in the future versions of the SmartMenus (or at least not implement more advanced features as it will be almost impossible), it would be nice if we could keep the menus functioning in it.. So my question- do you have any online example I could test with Netscape 4.x?
Thanks!
Date: 4 Nov 2004 4:01 pm
Hi - yes, I could put back the file that was failing but first let me explain.
It seems to be a known problem with Nets 4.x browsers that Javascript code "written on the fly" does not work when served up over the Internet. When I test this on my local machine, an IIS 5.0 web server and not really going over the internet, it works fine in Nets 4.7. When I put it on the Linux/Apache remote server is when I get the error. My belief is that there's nothing wrong with the file that's being generated from the database but something "happens" to it between the server and the browser that inserts something Nets 4.x doesn't like.
My solution was to build a quick utility on the client's application. The client logs into a 'backend' that allows him to add and remove catalog items, add and remove categories and subcategories, etc. All of this is in PHP with a MySQL database. So, I wrote a program in about 5 minutes that takes the category table (as in my posted example), but instead of doing it on the fly, this program generates the s_arrays.js file, saves it and now it's updated for the next visitor that comes along.
Because it's saved as a .js file and is there to start with, when the menu loads it there is no longer a problem.
So with that said, I've replaced the s_loader file so the .php generated s_arrays gets called. Still works fine everywhere except Nets 4.79 that I'm using. --> http://www.briancullity.com/default.php (in development - regular home page is pointing to default.htm)
Let me know what else you would like - thanks, as always, you're great. Jean
EDIT:
The "bad" file is no longer being served up by the URL listed.
Date: 5 Nov 2004 5:08 pm
I've updated the document (--> http://www.classicwebdesign.com/articles/DB_driven_Smartmenus.pdf) and I think it will be posted on the SmartMenus site also. The new instructions outline an alternative way of generating the s_arrays.js file from a database. This second solution explained in the document makes Netscape 4.x perfectly happy.
I've tested the generated .js file in the following browsers. The MAC OS 9.1, IE 4.5 (the very very oldest with known problems) gets a "unsupported function" error which I will try and find. The spacing of the menu in the table cell on Linux / Mozilla 1.4.1 is a little off but that should be easily fixed in my page where the menu is displayed.
All of the other browsers listed here performed perfectly.
Happy coding!
MAC OS 9.1
Netscape 7.02
Netscape 6.2.1
Netscape 4.76
IE 5.1
IE 4.5
Max OS X 10.2.8
IE 5.2
Safari 1.0.3 v85.8
Win2k SP4
IE 6.0 SP1 + patches
Netscape 7.2
Netscape 4.79
Mozilla 1.4
Fedora Core 1 (Linux)
Mozilla 1.4.1
WinXP SP2
IE 6.0 SP2
Netscape 7.1
Date: 10 Feb 2005 12:56 pm
You mention in the pdf that you would be working on an ASP version, any luck? Any insight on using ASP in the same manner as you did PHP would be appreciated.
Date: 10 Feb 2005 3:07 pm
Wow, did I say that?? Seriously, the client that I was going to do this for got involved over the holidays and didn't get her specs to me until last week. It looks like it will still be .asp, with one menu (sidebar) driven from an Access database and one menu, horizontal, that will be 'hardcoded'. It remains to be seen whether I'll be able to pull this off! Even though this one is Access driven, the SQL queries should be simple enough for use in SQL Server as well.
I'm finishing up two other sites this week, then this .asp site is next on the list. The menu will be first as it will be a part of the template for all pages.
Please be patient but feel free to remind me every week or so. I'll keep good notes while I'm putting the .asp driven menu together, so hopefully it will be useful to read when I'm done.
Thanks for your interest - Loon
Date: 22 Feb 2005 4:48 pm
It has been a while, and you asked to be reminded. so I am.
thanks.
Date: 22 Feb 2005 4:56 pm
Thanks! I'm working on that site right now. This one will have two menus, if I can pull it off - one horizontal and the database driven one will be vertical, down the left side, no frames. I'm on a roll finally so a few more days and I may have something worth sharing.
Meanwhile, look at the php example - php and asp are very very similar I find. Much of the code should look about the same, I hope :?
Date: 22 Feb 2005 5:08 pm
I have written my own, using your example, but my menu is for a large website that has to change as the user drills down through the site. I need to pass a variable from the asp page the user is on to the s_arrays.asp page. Does your application have any similar hurdles?
Date: 22 Feb 2005 5:21 pm
I haven't done anything exactly like that but using the php example, if you were to call the .asp page with the criteria for the next query - then loop through the results and build the menu, it should work. Pretty much the example that doesn't work in Netscape 4.x (#1 in the pdf doc) but add the code at the top to capture the query string variables passed in, stick those in the database query and you have a new query result to read through and create the menu.
Hope I didn't miss the point entirely. No - this one isn't going to do that but it shouldn't take much alteration to make it more dynamic yet by changing the db query at the beginning.
Date: 28 Feb 2005 11:29 am
My problem is, I need the "permanent" menu to change depending upon what section of the website you are in. I have the variable set at the top of the page, which also tells the templates what header and footer to display, but I cannot seem to pass a variable from the page, say index.asp to an asp page called in a file (s_loader.asp) which is in turn called via javascript by index.asp
any suggestions? I am unfamiliar with php, so I was not able to get much in this area from your example.
Date: 28 Feb 2005 12:02 pm
My example wouldn't help this, I agree. Maybe Vasil can lend some assistance here as I'm not a Javascript programmer at all.
Since you seem to be using asp for s_loader, then I think you should be able to put a variable on the end of the call to s_loader.asp in your page so when that page loads it passes that variable (kind of defining what your menu will be for the page) and picks it up in the s_loader.asp file, then insert the variable value on the end of the call to the s_arrays.asp; pick it up in s_arrays.asp and use it to determine the type of menu.
So index.asp has a line that calls s_loader.asp. But the next page they go to also has an s_loader.asp <-- put an argument on this one, so it might look like:
<script language=JavaScript1.2 src=s_loader.asp?nextmenu=123></script>
Now when s_loader.asp gets called above, pickup the variable in s_loader.asp that I called nextmenu with:
myMenuVariable = Request.QueryString("nextmenu")
Now stick 'myMenuVariable' on the end of the call to s_arrays.asp (in s_loader.asp file):
s_The_Arrays_Source='s_arrays.asp?myNewMenu=myMenuVariable';
Now at the top of s_arrays.asp grab the "myNewMenu" variable:
myMenu = Request.QueryString("myNewMenu")
Now, myMenu should equal '123' and be available to use in s_arrays.asp to determine how to build the menu.
Whew - did that make any sense?
Date: 28 Feb 2005 2:46 pm
Loon,
that did it. Thanks so much for the assist.
Stile
Date: 28 Feb 2005 3:07 pm
Stile,
Great! You're good if you could follow those directions! Thanks for letting us all know; it's likely to help someone else.
Loon