Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

include menu to switch language

Featured Replies

I am working on a bilingual site which has one folder for english site and another for the second language (welsh). The two folders are mirrors of eachother so all the files names are the same, just with a different folder name ie.

english/contact.php

welsh/contact.php

 

The navigation that switches from one language to another is a php include but I'm not sure how to create it so that, when clicked, the 'welsh' link takes my visitor from one page to the equivalent page in the welsh folder.

 

I currently do this with a static html navigation and hard code each link seperately but really need to make this work dynamically.

 

Can anyone help me out here?

many thanks

How about

 

<a href="<?php echo str_replace('/english/', '/welsh/', $_SERVER['PHP_SELF']) ?>">Welsh</a>

<a href="<?php echo str_replace('/welsh/', '/english/', $_SERVER['PHP_SELF']) ?>">English</a>

 

Then, if it's on the English page, the str_replace won't do anything, so the English link will be to self. And vice-versa.

How about

 

<a href="<?php echo str_replace('/english/', '/welsh/', $_SERVER['PHP_SELF']) ?>">Welsh</a>

<a href="<?php echo str_replace('/welsh/', '/english/', $_SERVER['PHP_SELF']) ?>">English</a>

 

Then, if it's on the English page, the str_replace won't do anything, so the English link will be to self. And vice-versa.

 

That's pretty much the exact answer I was going to give you!

  • Author
How about

 

<a href="<?php echo str_replace('/english/', '/welsh/', $_SERVER['PHP_SELF']) ?>">Welsh</a>

<a href="<?php echo str_replace('/welsh/', '/english/', $_SERVER['PHP_SELF']) ?>">English</a>

 

Then, if it's on the English page, the str_replace won't do anything, so the English link will be to self. And vice-versa.

 

Thanks so much, and for being so quick!

One day I will learn php but it's so hard to know where to start!!

 

diolch yn fawr (thanks very much in welsh!)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.