Automad
 All Classes Functions Variables Pages
Extensions\Gallery Class Reference

Public Member Functions

 Gallery ($options, $Automad)
 

Detailed Description

Create a simple gallery out of a set of images defined by a glob pattern.

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 25 of file gallery.php.

Member Function Documentation

Extensions\Gallery::Gallery (   $options,
  $Automad 
)

Every extension has one main method which will be called when parsing a template file. The name of that method is the same name as the name of the class and subnamespace (case insensitive). To group all files for an extension (.css and .js) the .php file of the class gets simply the same name as the containing folder: /extensions/gallery/gallery.php

All .css and .js files placed within /extensions/gallery get then automatically appended to the <head> section of the page when using the extension within a template file. In case there is also a minified version (for example gallery.css and gallery.min.css), only the minified version gets loaded.

In this case the naming pattern looks like:

  • namespace: Extensions
  • directory: /extensions/gallery
  • class file: /extensions/gallery/gallery.php
  • class: Gallery
  • method: Gallery

This main method must always have two parameters, which will be passed automatically when calling the extension: $obj->Gallery($options, $Automad)

  • $options: An array with all the options
  • $Automad: The Automad object

The example method below basically generates and returns the HTML for a simple image slideshow. The main method of an extension must always return the output for the template.

Note: The Gallery method is not a kind of constructor (like it would be in PHP 4). Since this is a namespaced class, a method with the same name as the last part of the namespace isn't called when creating an instance of the class (PHP 5.3+).

Parameters
array$options
object$Automad
Returns
The generated HTML of the gallery.

Definition at line 60 of file gallery.php.

References Automad\Core\Parse\fileDeclaration(), and Automad\Core\Html\generateImageSet().


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