Hawk - PHP documentation
  • Namespace
  • Class
  • Tree

Namespaces

  • Hawk
    • View
      • Plugins

Classes

  • App
  • ButtonInput
  • Cache
  • CheckboxInput
  • ColorInput
  • Conf
  • Controller
  • Crypto
  • DatabaseSessionHandler
  • DatetimeInput
  • DB
  • DBExample
  • DeleteInput
  • Dialogbox
  • EmailInput
  • ErrorHandler
  • Event
  • FileInput
  • FileSystem
  • FloatInput
  • Form
  • FormFieldset
  • FormInput
  • GenericModel
  • GifImage
  • HawkApi
  • HawkUpdater
  • HiddenInput
  • HtmlInput
  • HTTPRequest
  • Icon
  • Image
  • IntegerInput
  • ItemList
  • ItemListField
  • JpegImage
  • Lang
  • Language
  • LeftSidebarTab
  • Less
  • Logger
  • Mail
  • MenuItem
  • Model
  • NoSidebarTab
  • NumberInput
  • ObjectInput
  • Option
  • Panel
  • PasswordInput
  • Permission
  • Plugin
  • PluginInstaller
  • PngImage
  • ProfileQuestion
  • ProfileQuestionValue
  • RadioInput
  • Request
  • Response
  • RightSidebarTab
  • Role
  • RolePermission
  • Route
  • Router
  • SelectInput
  • Session
  • Singleton
  • SubmitInput
  • Tabs
  • TextareaInput
  • TextInput
  • Theme
  • TimeInput
  • Upload
  • User
  • View
  • ViewPlugin
  • Widget
  • WysiwygInput

Traits

  • Utils

Exceptions

  • AppStopException
  • DBExampleException
  • DBException
  • FileSystemException
  • HawkApiException
  • ImageException
  • MailException
  • UploadException
  • ViewException

Class View

This class describes the behavior of views

Direct known subclasses

Hawk\Dialogbox, Hawk\Icon, Hawk\LeftSidebarTab, Hawk\NoSidebarTab, Hawk\Panel, Hawk\RightSidebarTab, Hawk\Tabs

Namespace: Hawk
Package: View
Located at View.php

Methods summary

public
# __construct( string $file )

Constructor

Constructor

Parameters

$file
The template file to parse
public Hawk\View
# setData( array $data = array() )

Set data to display in the view

Set data to display in the view

Parameters

$data
The data to insert in the view. The keys of the data will become variables in the view

Returns

Hawk\View
The view itself
public Hawk\View
# addData( array $data = array() )

Add data to display in the view

Add data to display in the view

Parameters

$data
The data to add in the view

Returns

Hawk\View
The view itself
public array
# getData( )

Get the data pushed in the view

Get the data pushed in the view

Returns

array
The view data
public string
# display( )

Replace the keys in the template and display it

Replace the keys in the template and display it

Returns

string
The HTML result of the view, applied with the data
public static string
# make( string $file, array $data = array() )

Generate a view result

Generate a view result

Parameters

$file
The filename of the template
$data
The data to apply to the view

Returns

string
The HTML result of the view
public static string
# makeFromString( string $content, array $data = array() )

Generate a view from a string

Generate a view from a string

Parameters

$content
The string of the origin template
$data
The data to apply to the view

Returns

string
The HTML result of the string

Constants summary

string PLUGINS_VIEW

The directory containing the views plugins

The directory containing the views plugins

# 'view-plugins/'
string BLOCK_START_REGEX

The regular expression to match control structure openings

The regular expression to match control structure openings

# '#\{(if|elseif|else|for|foreach|while)\s*(\(.+?\))?\s*\}#i'
string BLOCK_END_REGEX

The regular expression to match control structure closings

The regular expression to match control structure closings

# '#\{\/(if|for|foreach|while)\s*\}#is'
string ECHO_REGEX

The regular expression to echo a variable

The regular expression to echo a variable

# '#\{{2}\s*(.+?)\}{2}#is'
string ASSIGN_REGEX

The regular expression for assignations

The regular expression for assignations

# '#\{assign\s+name=(["\'])(\w+)\\1\s*\}(.*?)\{\/assign\}#ims'
string PLUGIN_REGEX

The regular expression to match views plugins

The regular expression to match views plugins

# '#\{(\w+)((\s+[\w\-]+\=([\'"])((?:[^\4\\\\]|\\\\.)*?)\4)*?)\s*\}#sm'
string PLUGIN_ARGUMENTS_REGEX

The regular expression to match view plugins attributes

The regular expression to match view plugins attributes

# '#([\w\-]+)\=([\'"])(\{?)((?:[^\2\\\\]|\\\\.)*?)(\}?)\\2#sm'
string TRANSLATION_REGEX

The regular expresison to match translations

The regular expresison to match translations

# '#{(?!if)([a-zA-Z]{2})}(.*?){/\\1}#ism'
Hawk - PHP documentation API documentation generated by ApiGen