473,805 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to capture client browser address bar when click to an icon

osward
38 New Member
Hello everyone,

My site needs to support 3 different languages that runs under phpnuke 8.0, phpnuke provides language interface select function that allows switching from different interface, namely using different language files.

Every time when user is inside a module, when they click the language interface selection, it send the user back to the index page. I had found out a typical browser address to switch from language would read : http://mysite.com/ndex.php?newlan g=english

I had tried manually to alter the newlang=xxxx and it works and so as inside any other modules that won't send me back to index page. Therefore I could added different links in the module to let user switching language interface without leaving the module.

Here is what I want to achieve, I want to write a small function when user click a flag or link, the function capture the client's browser address and append the newlang=xxx and send it to the server to request the proper language. In this case I don't have to worry about adding links to every module manually.

What I really need is the code or php function to capture the user's browser address bar

Thanks in advance

Please help
Oct 20 '07
11 3319
osward
38 New Member
Heya, osward.

It's never getting to the else in your code because $_SERVER['REQUEST_URI'] exists.

If you're trying to replace the value in each URL, consider modifying $_GET and using http_build_quer y() as I suggested above. Since each array key can only have one corresponding value, this will ensure that each _GET variable is only output once in the query string, even if its value has changed.
Hi, pbmod,

I finally got it done by appending &newlang=englis h to your pervious code posted
Expand|Select|Wrap|Line Numbers
  1. $_linkPrefix = $_SERVER['SCRIPT_NAME'] . '?' . http_build_query($_GET);
The link to the English interface now read $_linkPrefix&ne wlang=english

However, I still don't understand and haven't use the first part of the code you posted
Expand|Select|Wrap|Line Numbers
  1. <base href="http://<?php echo $_SERVER['HTTP_HOST']; ?>" />
What do you mean by
If you have this in the head of your HTML:
I don't have any HTML documents here through the phpnuke. Am I missing you by a beat?
Oct 26 '07 #11
pbmods
5,821 Recognized Expert Expert
Heya, Osward.

The base tag allows you to specify sort of the 'prefix' for every link on your page.

I'm not too familiar with phpnuke specifically, but like any CMS, there should be a header file that you can edit that contains the HTML that goes at the top of every page.

Adding a base tag is not strictly necessary, but it makes it a lot easier to, for example, migrate your site to a new server or to make it easier to keep your link behavior consistent.

For more information, check out this article.
Oct 26 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2740
by: Marcia Gulesian | last post by:
How can I capture the event when I click (focus) with the cursor anywhere in the page (that is, on a component or elsewhere). This event would occur in an I.E 5.5 or later browser.
88
12589
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
4
5532
by: feng | last post by:
Hi, In our asp.net app, we need to capture the event when user close the browser window by clicking on the "x" button. But it doesn't seem to be as easy as it sound. Can someone show me how to do this? Thanks
1
2545
by: Hose B | last post by:
HI all, I have a legacy app in which users can pick various page templates. There is a template preview dialog. It works such that they view a list of icons in an asp page that represent each available page template. Each template is a straight-forward HTML file (not an asp or aspx) When a user clicks on an icon, the text comprising the selected template's HTML file is read into a string variable that is then injected into a <DIV> tag...
0
1686
by: Brad White | last post by:
Overview: I have a custom web app that has an 'Inbox' that refreshes every 30 seconds. One user uses Outlook to host the web page. Using IE, the refresh works fine. If the user is working in another window, the web page quietly refreshes in the background. Hosted in Outlook, the refresh causes Outlook to come to the front on every refresh. Or in XP, causes the toolbar icon to flash.
4
4814
by: Bill Manring | last post by:
I need to capture the event when the user closes the browser in my application. I have some code in the session_End event, which works fine when the session times out, but I need to end the session immediately when the user closes the browser. Does anyone know a way of doing this? -- Thanks,
4
2112
by: Ray Stevens | last post by:
Is it possible to place a company icon (logo) in the browser address field so that if a user copies it as a shortcut to his desktop the icon will be there. For example, like this: http://espn.go.com/
1
2800
by: Feng | last post by:
Hi, Need help on the following issue. We need to clean up some session specific backend resource when a user ends his session. We have a "Logoff" button on the pages that handles that. But the problem is that sometimes the user still closing their browser window by clicking on the "x" button of the window. This is quite a problem for us because it will leave unreleased resource on the server for an unpredictable period of time,...
5
3165
by: vasilis | last post by:
I have a list box in a site with which I capture a selected value with the onChange event using the capture_value() function (code listed below). This function passes 2 arguments, i.e., 'str' which is the selected list box value and 'passed_url' which is a passed url for running a php script (which contains some url query parameters, e.g. 'somescript.php?var1=value1&var2=value2&var3=value3'). The capture_value() function actually sends a...
0
9596
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,...
1
10364
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,...
0
10104
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7645
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
5541
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...
1
4317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3007
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.