Interchange Developer Resource
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date ][Interchange by thread ]

[ic] how do i refer to the current page using [area] or [page] tags?



> >
> Perhaps you need something like [env REQUEST_URI].
>

Thanks, I haven't tried this yet, but I eventually just gave up and am able
to do what I want using javascript.

If anyone is interested here's my code.  Its very simple.  It just puts the
locale code "/process/locale/es_ES/page" in between the "/cgi-bin/store2"
and the rest of the URL.  It checks to see if the locale string is already
in the path and removes it so it doesn't get doubled up.

As far as I know indexOf() and substring() methods of the location object
are supported in all browsers that support javascript so I feel pretty
confident using it.  I think I would need to add the session ID at the end
if I were worried about people who had their cookies turned off -- but I
dont' :)

-------- code starts here ----------

var path = location.pathname
if (path.indexOf("locale") < 0) {
  var newpath = path.substring(15, path.length)
  var msg = "| <a href=\"/cgi-bin/store2/process/locale/en_EN/page" +
newpath + "\" class=\"menuText\">English</a>"
  msg += " | <a href=\"/cgi-bin/store2/process/locale/es_ES/page" + newpath
+ "\" class=\"menuText\">Espa&ntilde;iol</a> |"
  document.write (msg)
} else {
  var newpath = path.substring(41, path.length)
  var msg = "| <a href=\"/cgi-bin/store2/process/locale/en_EN/page" +
newpath + "\" class=\"menuText\">English</a>"
  msg += " | <a href=\"/cgi-bin/store2/process/locale/es_ES/page" + newpath
+ "\" class=\"menuText\">Espa&ntilde;iol</a> |"
  document.write (msg)
}

--------- end code -----------



Search for: Sort by: