Item13879: WEB Variable describes a path; need variable for current working web
Priority: Enhancement
Current State: No Action Required
Released In: n/a
Target Release: n/a
By definition,
%WEB%
is the name of the current web, but that's not true for subwebs.
In subwebs,
%WEB%
produces the path to the current web through all other upper level webs.
For example, we have a lot of subwebs on our site. At this location:
http://wiki.cfcl.com/Projects/Access/Utiles/DS/WebHome,
%WEB%
evaluates to
Projects/Access/Utiles/DS
. It should evaluate to
DS
-- or there needs to be a variable that does.
--
VickiBrown - 01 Dec 2015
The web is defined as the Path/To/The/Web. It's the addressable web part of the Web.Topic address. So %WEB% IS the fully qualified web name. The last part is meaningless from a Foswiki perspective. You can get the last part easily with
SpreadSheetPlugin:
%CALCULATE{"$LISTITEM(-1,$SPLIT(/, %WEB%))"}%
--
GeorgeClark - 02 Dec 2015
Couple of options depending on the context:
All of them have format options to get the web
name, for instance
%WEBLINK{"Some/Deeply/Nested/InternalWeb" format="$name"}%
returns
InternalWeb
as a result.
--
MichaelDaum - 02 Dec 2015
The "other project" has added a
format
parameter to the %WEB% and %BASEWEB% macros.
format="..." Format, may include tokens $web (the full web path), $parents (parent webs, if any), $current (current web without parent webs), $top (top-level web with any subwebs removed) "$web"
This seems like a useful enhancement.
--
GeorgeClark - 15 Dec 2015
And... now that I review our implementation of the WEB, BASEWEB, etc. macros, they are not macros, they are preference settings, and are handled based upon the topic context. This would be a rather complex change I suspect.
--
GeorgeClark - 15 Dec 2015
I'm going to close this as no action needed. It's implemented as an extension - actually several choices of extensions.
--
GeorgeClark - 25 Mar 2017