\FOFView
FrameworkOnFramework View class. The View is the MVC component which gets the raw data from a Model and renders it in a way that makes sense. The usual rendering is HTML, but you can also output JSON, CSV, XML, or even media (images, videos, ...) and documents (Word, PDF, Excel...).
Synopsis
class FOFView
extends JObject
{
- // members
- protected $_name;
- protected $_models;
- protected $_basePath;
- protected $_defaultModel;
- protected $_layout;
- protected $_layoutExt;
- protected $_layoutTemplate;
- protected $_path;
- protected $_template;
- protected $_output;
- protected $_escape;
- protected $_charset;
- public $renderers;
- protected $config;
- protected FOFInput $input;
- protected FOFRenderAbstract $rendererObject;
- protected $doPreRender;
- protected $doPostRender;
- // Inherited members from JObject
- protected $_errors;
- // methods
- public void __construct()
- public boolean loadAnyTemplate()
- public mixed display()
- public boolean assign()
- public boolean assignRef()
- public mixed escape()
- public mixed get()
- public mixed getModel()
- public string getLayout()
- public string getLayoutTemplate()
- public string getName()
- public setModel()
- public string setLayout()
- public string setLayoutExt()
- public void setEscape()
- public void addTemplatePath()
- public void addHelperPath()
- public mixed loadTemplate()
- private array _parseTemplatePath()
- public FOFRenderAbstract getRenderer()
- public void setRenderer()
- protected FOFRenderAbstract findRenderer()
- public static void registerRenderer()
- public void setPreRender()
- public void setPostRender()
- public void loadHelper()
- public array getViewOptionAndName()
- protected void _setPath()
- protected void _addPath()
- protected string _createFileName()
- // Inherited methods from JObject
- public void __construct()
- public string __toString()
- public mixed def()
- public mixed get()
- public array getProperties()
- public string getError()
- public array getErrors()
- public mixed set()
- public boolean setProperties()
- public void setError()
Hierarchy
Extends
Extended by
Members
protected
- $_basePath
—
string
The base path of the view - $_charset
—
string
Charset to use in escaping mechanisms; defaults to urf8 (UTF-8) - $_defaultModel
—
string
The default model - $_errors
—
array
An array of error messages or Exception objects. - $_escape
—
string
Callback for escaping. - $_layout
—
string
Layout name - $_layoutExt
—
string
Layout extension - $_layoutTemplate
—
string
Layout template - $_models
—
array
Registered models - $_name
—
array
The name of the view - $_output
—
string
The output of the template script. - $_path
—
array
The set of search directories for resources (templates) - $_template
—
string
The name of the default template source file. - $config
—
array
Cache of the configuration array - $doPostRender
—
boolean
Should I run the post-render step? - $doPreRender
—
boolean
Should I run the pre-render step? - $input
—
FOFInput
The input object of this view - $rendererObject
—
FOFRenderAbstract
The chosen renderer object
public
- $renderers
—
array
The available renderer objects we can use to render views
Methods
private
- _parseTemplatePath() — Parses a template path in the form of admin:/component/view/layout or site:/component/view/layout to an array which can be used by loadAnyTemplate to locate and load the view template file.
protected
- _addPath() — Adds to the search path for templates and resources.
- _createFileName() — Create the filename for a resource
- _setPath() — Sets an entire array of search paths for templates or resources.
- findRenderer() — Finds a suitable renderer
public
- __construct() — Public constructor. Instantiates a FOFView object.
- addHelperPath() — Adds to the stack of helper script paths in LIFO order.
- addTemplatePath() — Adds to the stack of view script paths in LIFO order.
- assign() — Assigns variables to the view script via differing strategies.
- assignRef() — Assign variable for the view (by reference).
- display() — Overrides the default method to execute and display a template script.
- escape() — Escapes a value for output in a view script.
- get() — Method to get data from a registered model or a property of the view
- getLayout() — Get the layout.
- getLayoutTemplate() — Get the layout template.
- getModel() — Method to get the model object
- getName() — Method to get the view name
- getRenderer() — Get the renderer object for this view
- getViewOptionAndName() — Returns the view's option (component name) and view name in an associative array.
- loadAnyTemplate() — Loads a template given any path. The path is in the format: [admin|site]:com_foobar/viewname/templatename e.g. admin:com_foobar/myview/default
- loadHelper() — Load a helper file
- loadTemplate() — Overrides the built-in loadTemplate function with an FOF-specific one.
- registerRenderer() — Registers a renderer object with the view
- setEscape() — Sets the _escape() callback.
- setLayout() — Sets the layout name to use
- setLayoutExt() — Allows a different extension for the layout files to be used
- setModel() — Method to add a model to the view.
- setPostRender() — Sets the post-render flag
- setPreRender() — Sets the pre-render flag
- setRenderer() — Sets the renderer object for this view
Inherited from JObject
public
- __toString() — Magic method to convert the object to a string gracefully.
- def() — Sets a default value if not alreay assigned
- get() — Returns a property of the object or the default value if the property is not set.
- getError() — Get the most recent error message.
- getErrors() — Return all errors, if any.
- getProperties() — Returns an associative array of object properties.
- set() — Modifies a property of the object, creating it if it does not already exist.
- setError() — Add an error message.
- setProperties() — Set the object properties based on a named array/hash.