Forum Moderators: coopster

Message Too Old, No Replies

Adapt DHTML menu for MySQL stored links

Links stored in MySQL database

         

s9901470

12:28 pm on Mar 5, 2005 (gmt 0)

10+ Year Member



Hi

I would like to adapt this DHTML menu (or something similar) script so that the menu items come from a MySQL database:
[dynamicdrive.com...]

Any suggestions on how this could be done?

Thanks

dreamcatcher

4:28 pm on Mar 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you downloaded the code and taken a look at it? If its straight forward enough, simple replace the current variable with a PHP variable from your db.

dc

s9901470

2:08 pm on Mar 6, 2005 (gmt 0)

10+ Year Member



Is it OK to use PHP in a Javascript?
Thanks

ergophobe

4:50 pm on Mar 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It depends. Two situations

1. The Javascript is embedded in the page and that page is parsed as PHP. No problem there. The browser will have no idea that PHP was used to generate the Javascript.

2. The Javascript comes from an external file. In this case the server will not usually be set up to run the .js file through the PHP parser. This is no big deal, as you can set up to send anything, including JS files, through the PHP parser.

For more info on parsing JS files as PHP, see message 8 from StupidScript in this thread:
[webmasterworld.com...]