Automad
 All Classes Functions Variables Pages
Automad\Core\Resolve Class Reference

Static Public Member Functions

static filePath ($pagePath, $filePath)
 
static url ($Page, $url)
 

Detailed Description

The Resolve class holds all methods to modulate URLs and file paths. Since all page URLs are not URLs to real directories, all non-absolute links and file paths have to be resolved, to point to a valid location. For example a relative file name to an image wouldn't be a valid link, since the URL of the page is not the real file system path to the page's files.

Author
Marc Anton Dahmen hello.nosp@m.@mar.nosp@m.cdahm.nosp@m.en.d.nosp@m.e
License
MIT license - http://automad.org/license

Definition at line 56 of file resolve.php.

Member Function Documentation

static Automad\Core\Resolve::filePath (   $pagePath,
  $filePath 
)
static

Resolve a file path or glob pattern according to its type (root relative or relative).

If a file path begins with a '/', it is treated like a root relative path and the only AM_BASE_DIR gets prepended. In all other cases, the full path to the page gets prepended. For example a file called 'image.jpg' becomes '/basedir/pages/pagedir/image.jpg' and '/shared/image.jpg' becomes '/basedir/shared/image.jpg'.

Parameters
string$pagePath
string$filePath
Returns
The resolved file path

Definition at line 72 of file resolve.php.

Referenced by Automad\Core\Parse\fileDeclaration(), and Automad\Core\Toolbox\img().

static Automad\Core\Resolve::url (   $Page,
  $url 
)
static

Resolve an URL according to its type.

Absolute URLs, query strings, anchors or mails: not modified Root-relative URLs: AM_BASE_URL is prepended (and AM_INDEX in case of pages) Relative URLs: the full path gets prepended and all '../' and './' get resolved

Parameters
object$Page
string$url
Returns
The resolved URL

Definition at line 101 of file resolve.php.

References Automad\Core\Parse\isFileName().

Referenced by Automad\Core\Template\__construct().


The documentation for this class was generated from the following file: