Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Carry variable value to every page

Status
Not open for further replies.

dimsis

Programmer
Aug 6, 2000
76
GR
I want to add an AREAID variable to all CFM template of my application. (>than 1000 templates)
This areaid variable is an interger that must represent the current Area (city) and all the services of the site have to work according this value.
For example:
I have a forum, a webshop, a cms (for news) and an ads application that right now works only for ONE city.
I have added the AREAID field to all the tables of my application and now when an AreaID=1 has passed from URL, form or other method, all the services i've already mention, have to work for this AreaID.
I've also changed ALL the queries and add this AreaID, so if i'm for example in the news section of the site, and the areaid is 1 the query goes like:
SELECT * FROM NEWS WHERE areaID=1
What i need is a method to pass the areaID value into EVERY template of the site without adding it as application, session or cookie variable and of course WITHOUT changing the 1000 and more templates all the href, forms, cflocation etc adding the &areaid=#areaid# ...
IS there any other method to do this?
Is it possible for example everytime the user click's on a link of the site and another page loads, to carry this AreaID value?
(of course i want to dynamicaly change this AreaID value whenever needed, to change the city...)
 
Sorry but this is reinventing the wheel when you have so many choices to choose from.. why can't you set a session/application/cookie variable? Those are the methods..

Tony

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Because
1) session expires and if it expire while one administrator is filling a form that inserts or updates some data for a specific area (lets say session.areaid=5) when he/she submit the changes the #val(session.areaid)# will insert zero (0) as value or if we don't put a VAL an error will occur. (or i must write code to check if the session expired every now and then...)
2) If you use session (or cookie etc) how can you give a specific URL to another user or submit a url for a specific area to a search engine?
For example if we have set a session.areaid and i'm in:
In my query i know for what area id, but if anyone copy the URL or submit it to a search engine... ?

There are and some other issues too...i'm typing these 2 for now... that's why i'm searching for a solution.
(meanwhile, i've started to change ALL the files and adding to all href, cflocation, forms etc the areaid=#areaid# :( . This SUCKS big! so if there is any proposal please let me know)
 
Here's a fix...

Are you familiar with search engine friendly URLS.. how you can make..

index.cfm?AreaId=5

look like:

index.cfm/areaid/5

?

If you aren't, research it... you can then use scripting to check if cgi.path_info contains AreaID and if it does, you can get the next value in the list (Delimited with "/")..

And set the value to that..

Anyway its something to research..

Tony

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top