Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6087461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:52:23+00:00 2026-05-23T11:52:23+00:00

Our website has two language versions, Czech and English. We have a simple flag

  • 0

Our website has two language versions, Czech and English. We have a simple flag in the top right of each page (within header.php) that directs to either index_cz.php for the Czech index and index.php for the English index for all pages regardless of the current URL.

<a href="index_cz.php" target="_self"><img src="img/Czech-icon.png" width="64" height="64" alt="Czech language version"></a>
<a href="index.php" target="_self"><img src="img/United-Kingdom-icon.png" width="64" height="64" alt="English language version">

I would like something more sophisticated using PHP that changes the URL of the buttons depending on what the current page URL is. For example: if the current page is ‘new.php’ I would like the Czech button to now point to ‘new_cz.php’ and the English button to be ‘new.php’.

The pages that include ?id= endings (with whatever id is associated with that page) use a separate header.php and reference the appropriate id from the database for example:

<a href="project_cz.php?id=<?php echo $det[0];?>" target="_self"><img src="img/Czech-icon.png" width="64" height="64" alt="Czech language version"></a>    
<a href="project.php?id=<?php echo $det[0];?>" target="_self"><img src="img/United-Kingdom-icon.png" width="64" height="64" alt="English language version"></a>

Can you think of the appropriate code to handle the standard php pages? Many thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:52:23+00:00Added an answer on May 23, 2026 at 11:52 am

    You can access the current file with $_SERVER['PHP_SELF'], but make sure to run htmlspecialchars on it before echoing it to prevent XSS attacks.

    That said, you can then str_replace the current file to get the czech version:

    str_replace('.', '_cz.', $_SERVER['PHP_SELF'])
    

    the other way is easy, too:

    str_replace('_cz.', '.', $_SERVER['PHP_SELF'])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The past two times we have rebooted our sql server, our website has gone
Our ASP.NET 3.5 website running on IIS 6 has two teams that are adding
We have not purchased an SSL certificate so the user of our website has
A page within our MOSS publishing website has a property which is a lookup
We have a process in place that uploads files to our website. It has
on my website I have a sidebar panel, which has two tabs that when
Our website has a configuration page such as config.aspx, when the page initializing will
I have 100 property listings as wordpress posts and each post has two custom
Our website has one section which often changes to match the user. (examples are
In our client's website , favicon.ico file has several sizes from 8x8 to 32x32.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.