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

Static Public Member Functions

static addImage ($glob, $w=false, $h=false, $crop=false, $link=false, $target=false, $class=false, $addCaption=false)
 
static addLink ($Page, $classes= '', $text= '')
 
static addVariable ($name)
 
static generateBreadcrumbs ($pages, $separator= '')
 
static generateFilterMenu ($tags, $targetPage= '')
 
static generateImageSet ($files, $width=false, $height=false, $crop=false, $class=false, $firstWidth=false, $firstHeight=false, $firstClass=false, $enlargedWidth=false, $enlargedHeight=false)
 
static generatePagelist ($pages, $vars, $glob=false, $width=false, $height=false, $crop=false, $class=false, $maxChars=false, $header=false, $style=false, $firstWidth=false, $firstHeight=false, $firstClass=false)
 
static generateNav ($pages, $class=false)
 
static generateSearchField ($url, $placeholder=false, $formClass=false, $inputClass=false, $button=false, $buttonClass=false)
 
static generateSortMenu ($options)
 
static generateTree ($parentUrl, $expandAll, $collection)
 

Detailed Description

The Html class holds all methods to generate html.

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 52 of file html.php.

Member Function Documentation

static Automad\Core\Html::addImage (   $glob,
  $w = false,
  $h = false,
  $crop = false,
  $link = false,
  $target = false,
  $class = false,
  $addCaption = false 
)
static

Add an image with an optional link.

A glob pattern can be passed as an image. The first match will then be used. For example, using a glob pattern has the advantage of being able to display the first image of every page (as a logo or thumbnail), by just passing '*.jpg' or '*.png', without naming all the images the same.

The requested image can be optionally resized and cropped. If only a file is specified, the placed image keeps its original size and has no link. If the image is a JPG and the description field in its EXIF data is defined, that description is used for the title attribute.

Parameters
string$glob
string$w
string$h
boolean$crop
string$link
string$target
string$class
boolean$addCaption
Returns
the HTML of an img tag (optionally wrapped by the given link)

Definition at line 77 of file html.php.

References Automad\Core\Debug\log(), and Automad\Core\Parse\sanitize().

Referenced by Automad\Core\Html\generatePagelist(), Automad\Core\Toolbox\img(), and Extensions\Navbar\Navbar().

static Automad\Core\Html::addLink (   $Page,
  $classes = '',
  $text = '' 
)
static

Add link to $Page and check, if $Page is the current page or within the current path.

Parameters
object$Page
string$classes- additional classes to add to the link (separated by space as one string)
string$text- optional link text instead of page title
Returns
the HTML tag for the link to the given page

Definition at line 133 of file html.php.

Referenced by Automad\Core\Toolbox\linkNext(), Automad\Core\Toolbox\linkPrev(), and Extensions\Navbar\Navbar().

static Automad\Core\Html::addVariable (   $name)
static

Add a variable to the HTML of a template. In case an extension needs to generate a variable by itself automatically, this method can be used to generate the correct syntax for the variable markup, since all extensions will be parsed before the variables.

Parameters
string$name
Returns
The markup for the variable

Definition at line 174 of file html.php.

static Automad\Core\Html::generateBreadcrumbs (   $pages,
  $separator = '' 
)
static

Generate the HTML for a breadcrumb navigation out of a selection of pages.

Parameters
array$pages
string$separator
Returns
the HTML of the breadcrumbs

Definition at line 189 of file html.php.

Referenced by Automad\Core\Toolbox\navBreadcrumbs().

static Automad\Core\Html::generateFilterMenu (   $tags,
  $targetPage = '' 
)
static

Generate the HTML for filter menu out of $tags.

Parameters
array$tags
string$targetPage(default is empty, stay on same page)
Returns
the HTML of the filter menu

Definition at line 221 of file html.php.

References Automad\Core\Parse\queryArray(), and Automad\Core\Parse\queryKey().

Referenced by Automad\Core\Toolbox\filterParentByTags(), and Automad\Core\Toolbox\pagelistFilters().

static Automad\Core\Html::generateImageSet (   $files,
  $width = false,
  $height = false,
  $crop = false,
  $class = false,
  $firstWidth = false,
  $firstHeight = false,
  $firstClass = false,
  $enlargedWidth = false,
  $enlargedHeight = false 
)
static

Generate the HTML for a set of resized images linking to their bigger versions.

Parameters
array$files(array with file names)
integer$width
integer$height
integer$crop
string$class
integer$firstWidth(width for the first image)
integer$firstHeight(height for the first image)
string$firstClass(wrapping class for the first image)
integer$enlargedWidth(maximum width of enlarged images)
integer$enlargedHeight(maximum height of enlarged images)
Returns
The HTML of a list of images as links to their bigger versions.

Definition at line 297 of file html.php.

Referenced by Extensions\Gallery\Gallery(), and Automad\Core\Toolbox\imgSet().

static Automad\Core\Html::generateNav (   $pages,
  $class = false 
)
static

Generate the HTML of a navigation list for the passed pages.

Each page gets checked against the current URL. If the page is the current page or the page is a parent of the current page, additional classe will be added to the representing element.

Parameters
array$pages
string$class- optional wrapping class for the
the HTML of the navigation

Definition at line 524 of file html.php.

Referenced by Automad\Core\Toolbox\navBelow().

static Automad\Core\Html::generatePagelist (   $pages,
  $vars,
  $glob = false,
  $width = false,
  $height = false,
  $crop = false,
  $class = false,
  $maxChars = false,
  $header = false,
  $style = false,
  $firstWidth = false,
  $firstHeight = false,
  $firstClass = false 
)
static

Generate the HTML for a page list out of a selection of pages, an array of variables and optional image settings.

Parameters
array$pages(selected pages)
array$vars(variables to output in the list)
string$glob(one or more glob patterns to find a corresponding image within each page directory)
integer$width
integer$height
integer$crop
string$class(optional class for list items)
integer$maxChars(maximum number of characters to be displayed for each variable)
string$header(the list's header)
array$style(an array of css properties like { property: "page_variable_name", ... } to override the site's CSS on per item basis via inline styles)
integer$firstWidth(width for the image of the first list item)
integer$firstHeight(height for the image of the first list item)
string$firstClass(wrapping class for the first list item)
Returns
the HTML of the list

Definition at line 378 of file html.php.

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

Referenced by Automad\Core\Toolbox\pagelistMarkup().

static Automad\Core\Html::generateSearchField (   $url,
  $placeholder = false,
  $formClass = false,
  $inputClass = false,
  $button = false,
  $buttonClass = false 
)
static

Generate search field.

Parameters
string$url(URL of the results page)
string$placeholder(placeholder text)
string$formClass
string$inputClass
string$button(button text)
string$buttonClass
Returns
the HTML for the search field

Definition at line 559 of file html.php.

Referenced by Extensions\Navbar\Navbar(), and Automad\Core\Toolbox\search().

static Automad\Core\Html::generateSortMenu (   $options)
static

Generate the HTML for a list of sort buttons (item & order).

Parameters
array$options
Returns
The sort menu's HTML

Definition at line 596 of file html.php.

References Automad\Core\Parse\queryArray().

Referenced by Automad\Core\Toolbox\pagelistSort().

static Automad\Core\Html::generateTree (   $parentUrl,
  $expandAll,
  $collection 
)
static

Branch out recursively below a certain relative URL.

Parameters
string$parentUrl
boolean$expandAll
array$collection(all pages)
Returns
the HTML for the branch/tree (recursive)

Definition at line 640 of file html.php.

References Automad\Core\Automad\$collection.

Referenced by Automad\Core\Toolbox\navTree().


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