Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:50

need to use php within the menu files


Poster: Darkangel
Dated: Monday March 14 2005 - 16:41:02 GMT

Hi to all the team,

I've implemented the menu system which works perfectly but now i need to change the link of the image as they could come from two different sources!!

for the rest of my website i simply need instead of the image name to put
<? echo img_01; ?> for instance..

However my probleme is that here the name of those images are within a javascript file!
how can I make this echo works within the js file.

i thought of inserting the whole menu system in a php file, it still works but i don't know how to insert php withint javascript code...

thanks for helping me..

Re: need to use php within the menu files


Poster: kevin3442
Dated: Monday March 14 2005 - 18:46:04 GMT

Hi Darkangel,
Darkangel wrote:
i thought of inserting the whole menu system in a php file, it still works but i don't know how to insert php withint javascript code...

You are exactly on the right path. All you have to do is rename menu_data.js to menu_data.php and load the script into your page accordingly:
Code:
<script type="text/javascript" src="menu_data.php"></script>

Since you're loading the file in a javascript <script> block, the browser will see it as javascript code. And because the filename extension is .php, the code is run through the php parser on the server, and the result is delivered to the browser (the output in this case should be valid javascript code).

Cheers,

Kevin