473,785 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=ralei gh" 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 1983
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=ralei gh" 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.'">T est 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*****@XXXXre movetheXearthli nk.net> wrote in message
news:lx******** *********@newsr ead2.news.atl.e arthlink.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=ralei gh" 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
3425
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 converting a site of mine to PHP-Nuke, but if the individual modules aren't picked up in search engines I'm not going to do it. Thanks phpKid
10
8648
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 Blogger running, and I want to find a way to make users go to my discussion forum, but to automatically insert a link into the title of a new thread. Please see <http://blog.outer-court.com> as an example, and when you click on discuss you are taken...
26
12591
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
1819
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 href and src attributes to absolute URLs with this form: href="/somedir/somefile.htm" src="/images/somecategory/image.gif" That way, if you move a page from one directory to another, the links and image references within the page will not...
4
5335
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 some kind of parameter entity with a reference to an entity file:
4
5661
by: Swati Jain | last post by:
How I can pass dataset as parameter to javascript function?
15
8196
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
2161
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 value from the combo box, and clicks on the link, I want the value in the combo box to be passed as a parameter to another PHP page, and be used in that page. I really want to avoid forms and the whole GET/POST stuff.
3
3875
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 which redirect you to normal URLs with GET parameters
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10327
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.