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:20
Dropping Session IDs
Poster: dMc
Dated: Tuesday July 13 2004 - 5:34:08 BST
Hi
we are triailing this script inside a Shopping cart written in PHP, everything seems fine but The URLs however are dropping the session ID is there any syntax anyone knows of that will force the session id number to be carried thru the javascript?
and Yes the sessions are definately registered and open on every page throughout the script.
im afraid i cant post a public url as its a clients site under construction but if a moderator could perhaps PM or email me ill drop them the url as an example.
Thanks in Advance.
~dMc.
Poster: Andy
Dated: Tuesday July 13 2004 - 10:19:25 BST
Hi,
The easiest way would be to rename the menu_data.js file as menu_data.php and dynamically add the sessionid to each url.
By renaming the data file as a php file, this will enable PHP to add it's own data when the file is requested.
Hope this helps
Andy
Poster: dMc
Dated: Tuesday July 13 2004 - 11:26:57 BST
Could you please provide an example of what you mean by dynamically adding the session id?
Poster: Andy
Dated: Thursday July 15 2004 - 10:41:31 BST
Something along these lines:
Code:
aI("text=Session ID;url=test.php?sessionid=<?php echo sess$_SESSION["zim"];?>");
-- Andy
Poster: dMc
Dated: Friday July 16 2004 - 0:28:57 BST
thanks for your reply Andy, Im still not having any joys with it at this stage. I can see what you mean by your example but its just not working inside our script.
Im getting Invalid Syntax Javascript Errors and no menu appearing. Im still calling the menu_data.php file from the same style JS tag is this correct? or will i need to include it as i would a normal php include?
Again cheers for your patience in this and thankyou for your help so far.
Dan
Poster: Andy
Dated: Friday July 16 2004 - 10:22:21 BST
What output do you get from the .php file.
You can see this by visiting it with your web browser.
The menu at milonic.com can be viewed by visiting http://www.milonic.com/menu_data.php If you can give us a URL to your data file, we'll be able to take a look.
Cheers
Andy
Poster: dMc
Dated: Friday July 16 2004 - 11:02:21 BST
Hi Andy
whats your email and ill drop you the url.
Poster: kevin3442
Dated: Friday July 16 2004 - 20:53:57 BST
Hi dMc,
I've noticed that one fairly common cause of js errors in dynamic menu creation is echoing one or more newlines to the string passed to the menu's aI() function. If the php output that builds the aI() string contains a newline, that will effecively break the line of js code prematurely, with no continuation character, causing an error.
As I said... a fairly common cause of js errors when building js code from php, so I just thought I'd throw that out there, FWIW.
Kevin
Similar problem only a little more complicated
Poster: tubize
Dated: Tuesday July 20 2004 - 7:58:18 BST
I have a similar problem in passing a session variable to the Milonic menu and it may well be with the same shopping program. My site is Cold Fusion driven and I use CF to call up the dbase that I draw from in a vertical Milonic menu. I will try to summarize the environment because it can get very confusing.
1. The shopping program is in php so all the files that display are .php files.
2. To make the site easily customizable, they work with a template directory that includes only .html files that are included in the php file that is displayed.
3. The problem relates to the fact that you can toggle between two stores in the program - a US store and a UK store and I use both of them on the site.
4. From the template directory, I include my menu which has been converted to a cfm file. I include it using the js include as follows:
<SCRIPT src="/club/awcb/amazon_new/nav_amazon.cfm?lang={CURRENT_LANG}" language="javascript"></SCRIPT>
The problem I have is that the menu is not picking up the session language and it always reverts to the default lang which is UK. It works when I pass the language in a search box as a hidden field but it does not work when I pass two variables in the same command as I do here:
aI("text=#category_name#;url=/club/awcb/amazon_new/shop.php?i=#category_id#&lang=#url.lang#;");
I use dreamweaver and it automatically bolds the second variable so I suspect that maybe the menu does not like me using the & sign to join the two variables.
You can see it in action at http://www.awcb.org/club/awcb/amazon_ne ... hp?lang=us
Am I on the right track here? How do you append two variables to a url in the menu?
Thanks
Poster: John
Dated: Tuesday July 20 2004 - 15:35:48 BST
Wondering if this would make any difference...
Code:
i=#category_id#&lang=#url.lang#
Poster: tubize
Dated: Tuesday July 20 2004 - 16:01:48 BST
Thanks John, but it did not make a bif of ditterance.
Poster: John
Dated: Tuesday July 20 2004 - 16:14:11 BST
OK, 'nuther left-field. How 'bout calling the _data file with a cfinclude? Even though it's a mix of JS and CF, I'm wondering if the CF is actually getting processed, even though you have it defined as a .cfm
One of my _data files is also a .cfm (called with the standard JS call), but it does minimal CF stuff and no URLs - for it the + works.
Thinking about my suggestion - dumb idea. Sorry.
I'll take my ditterance and leave now...
Poster: tubize
Dated: Tuesday July 20 2004 - 16:55:12 BST
The CF in the left nav is definitely getting processed because it has a CF query calling up the categories.
Poster: dMc
Dated: Tuesday July 20 2004 - 22:34:08 BST
Hi Tubize,
our cart has been written in house and isnt in cold fusion but i think our problems are simliar though, our cart uses a main php script that contains all the functionality for the store then we use an ini file to handle the theme/layout in the site this ini file is included from within the main PHP script.
I have the menu_data.php being called from within the ini file which contains mainly html broken into blocks.
Poster: dMc
Dated: Tuesday July 27 2004 - 22:39:40 BST
Has anyone had any ideas on how this can be fixed yet, the url of the store im trying to setup is http://www.e-com.net.nz/test_mel/ im not sure if youll see anything different by looking at the site but im really pushed for time on solving this.