class Automad (View source)

The Automad class includes all methods and properties regarding the site, structure and pages.

A Automad object is the "main" object. It consists of many single Page objects, the Shared object and holds also additional data like the Filelist and Pagelist objects.

Properties

$Context Automad's Context object.
$Shared Automad's Shared object.

Methods

__construct()

Parse sitewide settings, create $collection and set the context to the currently requested page.

array
__sleep()

Define properties to be cached.

__wakeup()

Set new Context after being restored from cache.

array
getCollection()

Return $collection array.

object
getPage(string $url)

If existing, return the page object for the passed relative URL.

object
getFilelist()

Return Automad's instance of the Filelist class and create instance when accessed for the first time.

object
getPagelist()

Return Automad's instance of the Pagelist class and create instance when accessed for the first time.

boolean
currentPageExists()

Tests wheter the currently requested page actually exists and is not an error page.

string
loadTemplate(string $file)

Load and buffer a template file and return its content as string. The Automad object gets passed as parameter to be available for all plain PHP within the included file.

Details

__construct()

Parse sitewide settings, create $collection and set the context to the currently requested page.

array __sleep()

Define properties to be cached.

Return Value

array $itemsToCache

__wakeup()

Set new Context after being restored from cache.

array getCollection()

Return $collection array.

Return Value

array $this->collection

object getPage(string $url)

If existing, return the page object for the passed relative URL.

Parameters

string $url

Return Value

object $page or NULL

object getFilelist()

Return Automad's instance of the Filelist class and create instance when accessed for the first time.

Return Value

object Filelist object

object getPagelist()

Return Automad's instance of the Pagelist class and create instance when accessed for the first time.

Return Value

object Pagelist object

boolean currentPageExists()

Tests wheter the currently requested page actually exists and is not an error page.

Return Value

boolean True if existing

string loadTemplate(string $file)

Load and buffer a template file and return its content as string. The Automad object gets passed as parameter to be available for all plain PHP within the included file.

This is basically the base method to load a template without parsing the Automad markup. It just gets the parsed PHP content.

Before returning the markup, all comments <# ... #> get stripped.

Note that even when the it is possible to use plain PHP in a template file, all that code will be parsed first when buffering, before any of the Automad markup is getting parsed. That also means, that is not possible to make plain PHP code really interact with any of the Automad placeholder markup.

Parameters

string $file

Return Value

string The buffered output