- ⌂ Publishing
- Directives
#PATHFROM
Set the source path that #OUTPUT() and #LINK() will use to produce a relative path to the target file that they return.
Syntax
#PATHFROM(string $base_path) ... #ENDPATHFROM
Parameters
- base_path - The source path in one of the following forms. If a filename is provided at the end of the base_path, it will be ignored.
- Relative Path - A relative path will be evaluated relative to the current source path.
- Rooted Path - A rooted path will be evaluated from the Publication's Publish Path.
- Full URL - A URL starting with "http://" or other protocol will become the source path.
Return
This statement does not return a value or produce output.
Relative Path Example
#**
* Create and output an external custom CSS file just for this web page.
* The custom CSS file will be OUTPUT to a css/ subdirectory, so when we
* LINK to a background image within the custom css file, we want the
* link to be relative to where the custom CSS file will be located, not
* relative to where this web page that we are publishing.
*#
#NEW($CSS)
#PATHFROM('css/')
header { height: 80px; background: url(#LINK(Image,HeaderBg)); }
#ENDPATHFROM
#ENDNEW
#NEW($CSSFile)#OUTPUT('css/custom.css',$CSS)#ENDNEW
<html>
<head>
<title>Example Web Page</title>
<link type="text/css" rel="stylesheet" href="$CSSFile" />
</head>
<body>
<header>Example</header>
<h1>Example Web Page</h1>
<p>The cScript template creates and references
an external custom CSS file.</p>
</body>
</html>