Looking to create these 2 very specific (PHP-enhanced?) links
I realize there are probably 50 better ways to achieve the same results, but a long list of limitations that are out of my control is forcing me to really narrow down the custom solution I'm looking for.
I'm looking to create these two very specific links :
- An <a href=""> that targets the current/active url PLUS"_alt" in the filename
(so "domain.com/about" becomes "domain.com/about_alt") - An <a href=""> that targets the current/active url MINUS the last 4 characters.
(so "domain.com/about_alt" becomes "domain.com/about")
Every page on the site has an "_alt" version. I could insert the 1st link in the original template's navigation, and the other in the "alt" template, allowing users to easily bounce from either version of the page regardless of how many pages there are (without the use of databases or individual custom links). Even if there are thousands of pages, these 2 links would be all I need.
(The idea could be streamlined into a single link if the code had the ability to dynamically recognize whether the "_alt" is already present at the end of the current/active filename or not (adding it if it's not, removing it if it is). This would have the added benefit of allowing me to use 1 link across the site regardless of which version of the page I'm on (or template it's using). But this is more of a "nice to have" since even 2 links would solve pretty much everything.)
The site is currently plugged into jQuery and uses PHP (mostly for includes, I don't really know PHP beyond that). Additionally, thanks to you kind folks in this sub, I already have .htaccess stripping the extensions from the urls, so they needn't even be factored into the solution.
Am I being naïve believing 1 or 2 lines of PHP code in the <a> tag is all that might be needed here?
Thanks!
