Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

include current page name in link address

Participant ,
Sep 18, 2006 Sep 18, 2006
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

TOPICS
Server side applications
162
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 20, 2006 Sep 20, 2006
LATEST
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines