class Page (View source)

The Page class holds all properties and methods of a single page.

A Page object describes an entry in the collection of all pages in the Automad class. Basically the Automad object consists of many Page objects.

Properties

$data The $data array holds all the information stored as "key: value" in the text file and some other system generated information (:path, :level, :template .
$Shared The Shared data object.
$tags The $tags get also extracted from the text file (see $data).

Methods

__construct(array $data, Shared $Shared)

Set main properties.

string
__get(string $key)

Make basic data items accessible as page properties.

string
get(string $key)

Return requested data - from the page data array, from the shared data array or as generated system variable.

string
getMtime()

Get the modification time/date of the page.

string
getTemplate()

Return the template of the page.

bool
isCurrent()

Check if page is the current page.

bool
isInCurrentPath()

Check if the page URL is a part the current page's URL.

array
extractTags()

Extracts the tags string out of a given array and returns an array with these tags.

Details

__construct(array $data, Shared $Shared)

Set main properties.

Parameters

array $data
Shared $Shared

string __get(string $key)

Make basic data items accessible as page properties.

Parameters

string $key

Return Value

string The returned value from the data array

string get(string $key)

Return requested data - from the page data array, from the shared data array or as generated system variable.

The local page data array gets used as first and the shared data array gets used as second source for the requested variable. That way it is possible to override a shared data value on a per page basis. Note that not all data is stored in the data arrays. Some data (:mtime, :basename ...) should only be generated when requested out of performance reasons.

Parameters

string $key

Return Value

string The requested value

string getMtime()

Get the modification time/date of the page.

To determine to correct mtime, the page directory mtime (to check if any files got added) and the page data file mtime will be checked and the highest value will be returned.

Return Value

string The max mtime (directory and data file)

string getTemplate()

Return the template of the page.

Return Value

string The full file system path of the template file.

bool isCurrent()

Check if page is the current page.

Return Value

bool true if the the page is the currently requested page

bool isInCurrentPath()

Check if the page URL is a part the current page's URL.

Return Value

bool true if the the page is a parent of the currently requested page or the requeste page itself

private array extractTags()

Extracts the tags string out of a given array and returns an array with these tags.

Return Value

array $tags