You are here: Foswiki>Tasks Web>Item13879 (25 Mar 2017, GeorgeClark)Edit Attach

Item13879: WEB Variable describes a path; need variable for current working web

pencil
Priority: Enhancement
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: FoswikiUsability
Branches:
Reported By: VickiBrown
Waiting For:
Last Change By: GeorgeClark
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
 

ItemTemplate edit

Summary WEB Variable describes a path; need variable for current working web
ReportedBy VickiBrown
Codebase
SVN Range
AppliesTo Engine
Component FoswikiUsability
Priority Enhancement
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release02x01Checkins
Release02x00Checkins
Release01x01Checkins
Topic revision: r5 - 25 Mar 2017, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy