You are here: Foswiki>System Web>Category>UserDocumentationCategory>Macros>VarPUBURLPATH (2024-12-23, UnknownUser)Edit Attach
Generate a relative URL for an attachment, or for a web or topic within the attachment database.
Parameter | Description | Default |
---|---|---|
"attachment" | Name of attachment to link | |
web | Web | |
topic | Topic, or Web.Topic | |
topic_version | Select topic version, if supported | most recent |
attachment_version | Select attachment version, if supported | most recent |
%PUBURLPATH%
expands to /pub
%PUBURLPATH{"icon_plus.png"}%
expands to =%PUBURLPATH{"icon_plus.png"}%
%PUBURLPATH{web="System"}%
expands to /pub/System
%PUBURLPATH{topic="System.MainFeatures"}%
expands to /pub/System/MainFeatures
%PUBURLPATH{web="System" topic="MainFeatures"}%
expands to /pub/System/MainFeatures
%PUBURLPATH{topic="System.MainFeatures" "icon_plus.png"}%
expands to /pub/System/MainFeatures/icon_plus.png
topic_version
and attachment_version
parameters. These can be used with advanced store implements to select specific attachment versions. However simple file-based stores do not normally support them. This macro will only generate a relative URL if the store supports them, and the context allows it. Otherwise it will generate the same as PUBURL
The 'old' way of building URLs using PUBURLPATHPATH
involved concatenating the web and topic names to the PUBURLPATH
e.g. %PUBURLPATH%/%WEB%/%TOPIC%
. This practice is strongly discouraged, as it does not correctly handle encoding of the parts of the URL. At the first opportunity you should replace all such URLs with the equivalent %PUBURLPATH%{topic="System.MainFeatures"}%
, which will handle URL encoding for you.
ATTACHURLPATH provides a shorter way to refer to the attachments on the current topic.
PUBURL, ATTACHURL, ATTACHURLPATH, SCRIPTURL, SCRIPTURLPATH, FileAttachments
Edit | Attach | Print version | History: r1 | Backlinks | View wiki text | Edit wiki text | More topic actions
Topic revision: r1 - 2024-12-23, UnknownUser
Copyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback