Skip to main content
Inspiring
September 18, 2006
Question

include current page name in link address

  • September 18, 2006
  • 1 reply
  • 175 views
is there a piece of code I can use to include the current page name in a link to another folde rwhich contains and mirror image of the site structure but in a different language?

something like this:

<a href="../english/current-page.php">

That way whenever someone clicks on the link they will go to the right (same-name) page in whichever language they want. If it's possible I can simply add this lineto the template that governs each language an dmy job is done. If it's not possible, I have a long slog ahead of me, typing in each one individually.


Can anyone help?

Cheers


Dave

This topic has been closed for replies.

1 reply

Participating Frequently
September 20, 2006
You could write a Javascript function that returns the stripped-down name of the page being viewed, and embed that in value attribute of the a href tag. The location property of the window object in Javascipt contains the name of the current page. Then you can parse it out of that string with the split() function, using the \ and . as delimiters.

Or, there are variables in the CGI scope for PHP or whatever languages you are using. You could parse the page name out of that string using string manipulation functions in the particular language.