PDA

View Full Version : AnyLink Drop Down Menu & append_sid ?



fandaor
03-15-2007, 02:01 PM
1) Script Title: AnyLink Drop Down Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

3) Describe problem:
Hello,

First of all thank you for not only providing such usefull scripts but also maintaining them.

I have a slight problem when I use the drop down menu.
My site is using the append_sid function in order to parse the session from one page to another, avoiding to loose it this way.
The problem is that I don't find the way to put it in your code.

I tried to put it in the JS Array :

<script type="text/javascript">

/***********************************************
* AnyLink Drop Down Menu- Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="add_refin.php">Add Refining Recipe</a>'
menu1[1]='<a href="add_fini.php">Add Finishing Recipe</a>'
menu1[2]='<a href="updt_refin.php">Update Refining Recipe</a>'
menu1[3]='<a href="updt_fini.php">Update Finishing Recipe</a>'

And if I place it like this :

menu1[0]='<a href="' . append_sid('add_refin.php') . '">Add Refining Recipe</a>'

The menu is no longer appearing.

So far my menu is written like this :


echo('<a href="' . append_sid('forum/index.php') . '" target="_self"><img src="img/button_forum.jpg" /></a>');
echo('<a href="' . append_sid('index.php') . '" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, \'150px\')" onMouseout="delayhidemenu()"><img src="img/button_add.jpg" /></a>');
But the problem is that I loose the session if I click on the links in the drop down menu.

There surely exists a way to add the "append_sid" but I think I have reached the low level of knowledge I have.

Is there any kind person to help me, please ?

Best regards,

Fandaor

ddadmin
03-15-2007, 11:00 PM
JavaScript is no different from regular HTML when it comes to using PHP to output them. Just envision how you'd like the final output to be, and use PHP in the relevant areas of your menu item text so it's dynamically generated as desired. Something like:


menu1[0]='<a href="<?=append_sid('add_refin.php')?>">JavaScript Kit</a>'

You shouldn't have to dynamically modify the code of Step 2 at all, as you've done above with:


echo('<a href="' . append_sid('forum/index.php') . '" target="_self"><img src="img/button_forum.jpg" /></a>');
echo('<a href="' . append_sid('index.php') . '" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, \'150px\')" onMouseout="delayhidemenu()"><img src="img/button_add.jpg" /></a>');


I don't see how that part is relevant as far as appending a sid to the menu URLs.

fandaor
03-16-2007, 09:32 AM
Marvelous !!!

Sorry for the question but I have completely forgot the syntax in the JScript ^^



menu1[0]='<a href="<?=append_sid('add_refin.php')?>">JavaScript Kit</a>'

It work perfectly !


Many thanks again :)


Fandaor