Dropping Session IDs

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
dMc
Beginner
Beginner
Posts: 6
Joined: Tue Jul 13, 2004 5:28 am

Dropping Session IDs

Post by dMc »

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.
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

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
dMc
Beginner
Beginner
Posts: 6
Joined: Tue Jul 13, 2004 5:28 am

Post by dMc »

Could you please provide an example of what you mean by dynamically adding the session id?
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Something along these lines:

Code: Select all

aI("text=Session ID;url=test.php?sessionid=<?php echo sess$_SESSION["zim"];?>");
-- Andy
dMc
Beginner
Beginner
Posts: 6
Joined: Tue Jul 13, 2004 5:28 am

Post by dMc »

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
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

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://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
dMc
Beginner
Beginner
Posts: 6
Joined: Tue Jul 13, 2004 5:28 am

Post by dMc »

Hi Andy

whats your email and ill drop you the url.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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
tubize
Advanced
Advanced
Posts: 27
Joined: Tue Sep 30, 2003 9:14 am

Similar problem only a little more complicated

Post by tubize »

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
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Wondering if this would make any difference...

Code: Select all

i=#category_id#&lang=#url.lang#
John
tubize
Advanced
Advanced
Posts: 27
Joined: Tue Sep 30, 2003 9:14 am

Post by tubize »

Thanks John, but it did not make a bif of ditterance.
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

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... :roll:
John
tubize
Advanced
Advanced
Posts: 27
Joined: Tue Sep 30, 2003 9:14 am

Post by tubize »

The CF in the left nav is definitely getting processed because it has a CF query calling up the categories.
dMc
Beginner
Beginner
Posts: 6
Joined: Tue Jul 13, 2004 5:28 am

Post by dMc »

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.
dMc
Beginner
Beginner
Posts: 6
Joined: Tue Jul 13, 2004 5:28 am

Post by dMc »

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.
Chris K
Beginner
Beginner
Posts: 4
Joined: Fri Aug 13, 2004 10:56 pm
Contact:

Post by Chris K »

Post a URL to a text file with all of your PHP code (from beginning to end).

I'll be glad to take a look at it.
Post Reply