473,320 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

add parameter to all URLs



I am trying to make something similar to citysearch.com. For example:

If you search for a city, say Raleigh, NC, it will find it for you,
but then all other URLs on the page will have the location parameter
attached. For example, say "city=raleigh" So, if you go back to the
home page, or any other page on the site, that will still be attached to
the URL. Is there any easy way to do that? I know PHP has a way to
automatically attach a session ID to every URL.

Is there a way I can attach a parameter of my own choosing automatically?

I don't think cookies will work in this situation. The problem with
cookies is that there is only one cookie with one location in it, where
the user may have several pages open for different locations.

what do you think?
Jul 17 '05 #1
2 1965
Doug wrote:


I am trying to make something similar to citysearch.com. For example:

If you search for a city, say Raleigh, NC, it will find it for you,
but then all other URLs on the page will have the location parameter
attached. For example, say "city=raleigh" So, if you go back to the
home page, or any other page on the site, that will still be attached to
the URL. Is there any easy way to do that? I know PHP has a way to
automatically attach a session ID to every URL.

Is there a way I can attach a parameter of my own choosing automatically?

I don't think cookies will work in this situation. The problem with
cookies is that there is only one cookie with one location in it, where
the user may have several pages open for different locations.

what do you think?

Just a quick solution, write a little function like so:

<?php

function appendit() {
if(isset($_GET)) {
$message = '?';
foreach($_GET as $append_key => $append_val ) {
$message .= $append_key.'='.$append_val.'&';
}
}
return $message;
}
$urladdon = appendit();

echo '<a href="test.php'.$urladdon.'">Test Page</a>";
?>

Something like that should do the trick, there might be more automated
ways about, let the group know your findings.

Hope that helps,

Anthony.
Jul 17 '05 #2
"Doug" <do*****@XXXXremovetheXearthlink.net> wrote in message
news:lx*****************@newsread2.news.atl.earthl ink.net...


I am trying to make something similar to citysearch.com. For example:

If you search for a city, say Raleigh, NC, it will find it for you,
but then all other URLs on the page will have the location parameter
attached. For example, say "city=raleigh" So, if you go back to the
home page, or any other page on the site, that will still be attached to
the URL. Is there any easy way to do that? I know PHP has a way to
automatically attach a session ID to every URL.

Is there a way I can attach a parameter of my own choosing automatically?

I don't think cookies will work in this situation. The problem with
cookies is that there is only one cookie with one location in it, where
the user may have several pages open for different locations.

what do you think?


Go way to do this is to turn on output buffering then attach the parameters
to every hyperlink with help from regular expression. A manual search and
replace is probably best though--and probably quicker.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: phpkid | last post by:
Howdy I've been given conflicting answers about search engines picking up urls like: http://mysite.com/index.php?var1=1&var2=2&var3=3 Do search engines pick up these urls? I've been considering...
10
by: Philipp Lenssen | last post by:
I know it's terribly incorrect (well I think I know) to use something like <a href="bla.php?title=hello world">Hello World</a> but can I safely do this? I have an Apache Linux server with...
26
by: Howard Brazee | last post by:
I would like to click on a URL of a html document that will open several URLs at once for me. Does someone have an example of a html document that will do this?
1
by: DM | last post by:
I'm working on a site with more than 1700 HTML files. We'll be moving files around on this site a lot because we're reorganizing it. I'm thinking of writing a script that will convert all URLs in...
4
by: Erwin Gabler | last post by:
Trying to validate a document with a reference to a DTD ("PUBLIC" identifier): <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE systems-description PUBLIC "-//foo/nono" ""> .... The DTD uses...
4
by: Swati Jain | last post by:
How I can pass dataset as parameter to javascript function?
15
by: Ludwig | last post by:
What's the best way to pass xml data to a web service: as XmlDocument, or as a string, or....? (the xml data is structured by XSD) Thanks, kind regards, -- Ludwig http://www.coders-lab.be
10
by: amerar | last post by:
Hi All, I am writing some screen strictly in PHP. I have a screen with a combo box in it. I do not want to use forms, just links on the page. What I want to do, is when the user selects the...
3
by: WebCM | last post by:
How to apply nice URL-s into CMS? 1. Should we use nice urls for every page? 2. Do we need to put a FULL path into <a href="">? 3. What is faster and better? a) 10 rules in .htaccess...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.