0

I have created a custom header (header.php) and one of the components in it is the flag representing the langauge of the site.

What I am looking to do is, IF the current webpage URL is "www.abcde.com/en" then Do X, where X will be the for the English Flag. If Else, then Do Y, where Y is to load for the Chinese flag.

I do not want to create seperate header files as the only difference is this.

Looking forward to your expert advice :)

  • `$_SERVER['REQUEST_URI']` extract 'en' –  May 28 '18 at 01:38
  • Possible duplicate of [Get current URL path in PHP](https://stackoverflow.com/questions/16198790/get-current-url-path-in-php) – Devon Bessemer May 28 '18 at 01:39
  • Thank you Smith Can you please get me the full query to write as am zero on PHP Basically i have all my pages loading under www.abcde.com/en/asd/asd/asd/sad/ or www.abcde.com/cn/asd/asd/asd/asd/ So the comparision is only for first few charachters of the URL.. which is upto "www.abcde.com/en" 1. How to get this part 2. How to code the rest to do what i want...IE : If value is true, then Do X.. If value is false then do Y – Anushka May 28 '18 at 01:49
  • this is not a free coding service, so no I'm not wring your php for you. either start learning, or hire some one –  May 28 '18 at 02:02

0 Answers0