Board Logo

Passing Dynamic URL Parameters
Russell411 - 4/3/2007 at 06:38 PM


I hope you can point out what I'm doing wrong. I need to pass additional URL parameters/variables through my menu.

From a previous post (, I understand that it should be pretty easy:

1. Simply copy my menu_items.js file to a new file with my dynamic version extension (in my case with Coldfusion, it becomes menu_items.cfm, for PHPers it'd be menu_items.php, asp = menu_items.asp, etc.).

2. Then on the page where the menu is called, I changed the line reading:
<script language="JavaScript" src="menu_items.js">
<script language="JavaScript" src="menu_items.cfm">

This makes my menu not appear at all (the two files are identical, I haven't added anything dynamic yet)... and other than whitespace, both render the same in my browser as well.

Thanks in advance for any help,

Russell Schutte

P.S. For those who are searching the forum, you can then in your menu_items.js folder change your URL to a dynamic version:
['Support', 'index.cfm?PageID=2']

could be (Coldfusion example):
['Support', 'index.cfm?PageID=2&URLVariable=#UserID#']

or (PHP Example):
['Support', 'index.cfm?PageID=2&URLVariable=$UserID']

Russell411 - 4/3/2007 at 08:19 PM


I've discovered a little something - by viewing source. There is indeed a difference... Since I'm running this on my development machine - when my CFM page is created, it adds this line to the very top of the file:

<META NAME="ColdFusionMXEdition" CONTENT="ColdFusion DevNet Edition - Not for Production Use.">

I presume that is what's making my menu barf. :-)

So, I've got that one solved... Now I'm wondering, if I change my site to the ColdFusion Database Method (, is it possible to use these same URL parameters?

For some reason, I think it might work, but would need the use of the EVALUATE function or something?

Thanks again,

Russell Schutte

Russell411 - 4/3/2007 at 09:02 PM


I thought I had it... This simple little thing has taken me half a day!

Now I've got it working - mostly. Hopefully there's a ColdFusion person out there who can explain what's going on...

In my application.cfm file (run with each page request), I am testing for the existence of a VisitorID (URL passed). If one doesn't exist, I create a local VisitorID which will be passed with all future page requests.

My problem: The menu seems to be initiating it's own page request - since it gets a new VisitorID with every page request. It somehow doesn't recognize the already existing VisitorID (even when passed through the URL) and application.cfm gives it a new VisitorID every time.

So, when I browse a page - in the same page my menu has a unique VisitorID - while the page itself shows the VisitorID that was passed in the URL as a parameter.

Any ideas on this one?


Russell Schutte

Russell411 - 4/3/2007 at 09:38 PM

Boy, I hope someone reads this... It should save the next ColdFusion'er a lot of time.

I still have no idea why the menu seems to generate it's own session, but I have figured out a workaround.

My menu_items.cfm file looks like this:
<cfsetting showdebugoutput="No">
/* Tigra Menu items structure */
var MENU_ITEMS = [
['Menu Header', 'index.cfm?PageID=32&VisitorID=#Session.VisitorID#', null,
['SubMenu Item One', 'index.cfm?PageID=2&VisitorID=#Session.VisitorID#']
['SubMenu Item Two', 'index.cfm?PageID=2&VisitorID=#Session.VisitorID#']

My application.cfm file looks like this:

<CFPARAM name="Session.VisitorID" default="">
<cfif Session.VisitorID IS "">
<cfset Session.VisitorID = RandRange(1, 2000000000)>
<cfset VisitorID = Session.VisitorID>

For whatever reason, reassigning Session.VisitorID to VisitorID (the last line) seems to make it work - even though a new session seems to be generated when the menu generates....

So, finally... any ideas how to proceed in putting all of this into the database using the ColdFusion Database Method ( I'd really like to have everything in my database.

But, it's notoriously troublesome to try to run ColdFusion code stored in a database. Has anyone gotten this working to generate the menu with additional URL parameters???

Thanks again,

Russell Schutte

Back to forum: