Mauricen Posted March 12, 2013 Share Posted March 12, 2013 Hi, PHP geniuses. I am a PHP novice and am stuck. For someone knowledgeable, this should be pretty easy, but it is stumping me. I have a site that is multiple languages. The only difference in the pages from one language to the next is a "/it/" at the end of the main url before the page name. I need 2 inline PHP statements that create hrefs: One that creates a link that says "remove 'it/' from the current page URL One that takes the current url and ads a 'it/" after the domain name and before the page name in a link. Example: If the current page URL is http://www.xxx.com/it/test/ - it creates a link that is http://www.xxx.com/test/ The second piece of code creates a link that changes http://www.xxx.com/test/ to http://www.xxx.com/it/test/ I have played with some PHP string replace commands, but I can't get it to work. I need something like: <a href='<?php echo str_replace ("/it/",""; ?>'> Anyway, bad code example, but you get the idea. Anyone know a quick fix here? Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.