You are seeing this error because the view =$this->missing_view;?>
+
You are seeing this error because the view =$this->missingView;?>
for action =$this->params['action'];?>
in controller =Inflector::camelize($this->name);?> could not be found.
@@ -11,7 +11,7 @@ view file, a user-customizable error page for handling missing/invalid views dur
-Fatal: Unable to load view file =$this->missing_view;?> for
+Fatal: Unable to load view file =$this->missingView;?> for
action =$this->params['controller'];?>::=$this->params['action'];?>
diff --git a/libs/controller.php b/libs/controller.php
index 5331c651d..c2a25461a 100644
--- a/libs/controller.php
+++ b/libs/controller.php
@@ -84,10 +84,18 @@ class Controller extends Template
* An array of names of models the particular controller wants to use.
*
* @var mixed A single name as a string or a list of names as an array.
- * @access private
+ * @access protected
*/
var $uses = false;
+ /**
+ * An array of names of built-in helpers to include.
+ *
+ * @var mixed A single name as a string or a list of names as an array.
+ * @access protected
+ */
+ var $helpers = array('html');
+
/**
* Constructor.
*
@@ -98,7 +106,9 @@ class Controller extends Template
$r = null;
if (!preg_match('/(.*)Controller/i', get_class($this), $r))
- die("Controller::__construct() : Can't get or parse my own class name, exiting.");
+ {
+ die("Controller::__construct() : Can't get or parse my own class name, exiting.");
+ }
$this->name = strtolower($r[1]);
$this->viewpath = Inflector::underscore($r[1]);
@@ -134,22 +144,22 @@ class Controller extends Template
parent::__construct();
}
- function missing_controller()
+ function missingController()
{
$this->autoRender = false;
- $this->render('../errors/missing_controller');
+ $this->render('../errors/missingController');
}
- function missing_action()
+ function missingAction()
{
$this->autoRender = false;
- $this->render('../errors/missing_action');
+ $this->render('../errors/missingAction');
}
- function missing_view()
+ function missingView()
{
$this->autoRender = false;
- $this->render('../errors/missing_view');
+ $this->render('../errors/missingView');
}
/**
diff --git a/libs/dispatcher.php b/libs/dispatcher.php
index 633cb833a..5f13c0954 100644
--- a/libs/dispatcher.php
+++ b/libs/dispatcher.php
@@ -1,326 +1,317 @@
- + //
-// + Copyright: (c) 2005, Cake Authors/Developers + //
-// + Author(s): Michal Tatarynowicz aka Pies + //
-// + Larry E. Masters aka PhpNut + //
-// + Kamil Dzielinski aka Brego + //
-// +------------------------------------------------------------------+ //
-// + Licensed under The MIT License + //
-// + Redistributions of files must retain the above copyright notice. + //
-// + See: http://www.opensource.org/licenses/mit-license.php + //
-//////////////////////////////////////////////////////////////////////////
-
-/**
- * Purpose: Dispatcher
- * Dispatches the request, creating aproppriate models and controllers.
- *
- * @filesource
- * @author Cake Authors/Developers
- * @copyright Copyright (c) 2005, Cake Authors/Developers
- * @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
- * @package cake
- * @subpackage cake.libs
- * @since Cake v 0.2.9
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
- * @license http://www.opensource.org/licenses/mit-license.php The MIT License
- */
-
-/**
- * Description:
- * Dispatches the request, creating appropriate models and controllers.
- */
-
-define('DISPATCH_NO_CONTROLLER', 'missing_controller');
-define('DISPATCH_UNKNOWN_CONTROLLER', 'missing_controller');
-define('DISPATCH_NO_ACTION', 'missing_action');
-define('DISPATCH_UNKNOWN_ACTION', 'missing_action');
-define('DISPATCHER_UNKNOWN_VIEW', 'missing_view');
-
-uses('error_messages', 'object', 'router', 'controller');
-
-/**
- * Dispatches the request, creating appropriate models and controllers.
- *
- * @package cake
- * @subpackage cake.libs
- * @since Cake v 0.2.9
- */
-class Dispatcher extends Object
-{
-
-/**
- * Base URL
- *
- * @var unknown_type
- */
- var $base = false;
-/**
- * Enter description here...
- *
- * @var array
- */
- var $passed_args = array();
-
-/**
- * Constructor.
- */
- function __construct ()
- {
- $this->base = $this->baseUrl();
- parent::__construct();
- }
-
-/**
- * Enter description here...
- *
- * @param string $url
- * @return unknown
- */
- function dispatch($url)
- {
- $params = $this->parseParams($url);
- $result = $this->invoke($url);
-
- return $result === true? $params: array();
- }
-
-/**
- * Enter description here...
- *
- * @param string $url
- * @return unknown
- */
- function invoke ($url)
- {
- global $_POST, $_GET, $_FILES, $_SESSION;
-
- $params = $this->parseParams($url);
- $missing_controller = false;
- $missing_action = false;
- $missing_view = false;
-
- if (empty($params['controller']))
- {
- $missing_controller = true;
- }
- else
- {
- $ctrl_name = Inflector::camelize($params['controller']);
- $ctrl_class = $ctrl_name.'Controller';
-
- if (!loadController($ctrl_name) || !class_exists($ctrl_class))
- {
- $missing_controller = true;
- }
- }
-
- if ($missing_controller)
- {
- $ctrl_class = 'AppController';
- $controller = new $ctrl_class($this);
- $params['action'] = 'missing_controller';
- $controller->missing_controller = $params['controller'];
- }
- else
- {
- // create controller
- $controller = new $ctrl_class($this);
- }
-
- // if action is not set, and the default Controller::index() method doesn't exist
- if (empty($params['action']))
- {
- if (method_exists($controller, 'index'))
- {
- $params['action'] = 'index';
- }
- else
- {
- $missing_action = true;
- }
- }
-
- // if the requested action doesn't exist
- if (!method_exists($controller, $params['action']))
- {
- $missing_action = true;
- }
-
- if ($missing_action)
- {
- $controller->missing_action = $params['action'];
- $params['action'] = 'missing_action';
- }
-
- // initialize the controller
- $controller->base = $this->base;
- $controller->here = $this->base.'/'.$url;
- $controller->params = $params;
- $controller->action = $params['action'];
- $controller->data = empty($params['data'])? null: $params['data'];
- $controller->passed_args = empty($params['pass'])? null: $params['pass'];
-
- // EXECUTE THE REQUESTED ACTION
- call_user_func_array(array(&$controller, $params['action']), empty($params['pass'])? null: $params['pass']);
-
- $isFatal = isset($controller->isFatal) ? $controller->isFatal : false;
-
- if ($isFatal)
- {
- switch($params['action'])
- {
- case 'missing_controller':
- $this->errorUnknownController($url, $ctrl_name);
- break;
-
- case 'missing_action':
- $this->errorUnknownAction($url, $ctrl_class, $controller->missing_action);
- break;
- }
- }
-
- if ($controller->autoRender)
- {
- $controller->render();
- }
-
- return true;
- }
-
-/**
- * Returns array of GET and POST parameters. GET parameters are taken from given URL.
- *
- * @param string $from_url
- * @return array Parameters found in POST and GET.
- */
- function parseParams ($from_url)
- {
- global $_POST, $_FILES;
-
- // load routes config
- $Route = new Router();
- include CONFIGS.'routes.php';
- $params = $Route->parse ($from_url);
-
- // add submitted form data
- $params['form'] = $_POST;
- if (isset($_POST['data']))
- $params['data'] = $_POST['data'];
-
- foreach ($_FILES as $name => $data)
- $params['form'][$name] = $data;
-
- return $params;
- }
-
-/**
- * Returns a base URL.
- *
- * @return string
- */
- function baseUrl ()
- {
- global $_SERVER;
-
- //non mod_rewrite use:
- if (defined('BASE_URL')) return BASE_URL;
-
- $doc_root = $_SERVER['DOCUMENT_ROOT'];
- $script_name = $_SERVER['PHP_SELF'];
-
- // if document root ends with 'public', it's probably correctly set
- $r = null;
- if (ereg('/^.*/public(\/)?$/', $doc_root))
- return preg_match('/^(.*)\/index\.php$/', $script_name, $r)? $r[1]: false;
- else
- // document root is probably not set to Cake 'public' dir
- return preg_match('/^(.*)\/public\/index\.php$/', $script_name, $r)? $r[1]: false;
- }
-
-/**
- * Displays an error page (e.g. 404 Not found).
- *
- * @param int $code Error code (e.g. 404)
- * @param string $name Name of the error message (e.g. Not found)
- * @param string $message
- */
- function error ($code, $name, $message)
- {
- $controller = new Controller ($this);
- $controller->base = $this->base;
- $controller->error($code, $name, $message);
- }
-
-/**
- * Convenience method to display a 404 page.
- *
- * @param unknown_type $url
- * @param unknown_type $message
- */
- function error404 ($url, $message)
- {
- $this->error('404', 'Not found', sprintf(ERROR_404, $url, $message));
- }
-
-/**
- * If DEBUG is set, this displays a 404 error with the message that no controller is set. If DEBUG is not set, nothing happens.
- *
- * @param string $url
- */
- function errorNoController ($url)
- {
- DEBUG?
- trigger_error (ERROR_NO_CONTROLLER_SET, E_USER_ERROR):
- $this->error404($url, "no controller set");
- exit;
- }
-
-/**
- * If DEBUG is set, this displays a 404 error with the message that the asked-for controller does not exist. If DEBUG is not set, nothing happens.
- *
- * @param string $url
- * @param string $controller_class
- */
- function errorUnknownController ($url, $controller_class)
- {
- DEBUG?
- trigger_error (sprintf(ERROR_UNKNOWN_CONTROLLER, $controller_class), E_USER_ERROR):
- $this->error404($url, "missing controller \"{$controller_class}\"");
- exit;
- }
-
-/**
- * If DEBUG is set, this displays a 404 error with the message that no action is set. If DEBUG is not set, nothing happens.
- *
- * @param string $url
- */
- function errorNoAction ($url)
- {
- DEBUG?
- trigger_error (ERROR_NO_ACTION_SET, E_USER_ERROR):
- $this->error404(sprintf(ERROR_404, $url, "no action set"));
- exit;
- }
-
-/**
- * If DEBUG is set, this displays a 404 error with the message that no such action exists. If DEBUG is not set, nothing happens.
- *
- * @param string $url
- * @param string $controller_class
- * @param string $action
- */
- function errorUnknownAction ($url,$controller_class, $action)
- {
- DEBUG?
- trigger_error (sprintf(ERROR_NO_ACTION, $action, $controller_class), E_USER_ERROR):
- $this->error404($url, "missing controller \"{$controller_class}\"");
- exit;
- }
-}
-
-?>
+ + //
+// + Copyright: (c) 2005, Cake Authors/Developers + //
+// + Author(s): Michal Tatarynowicz aka Pies + //
+// + Larry E. Masters aka PhpNut + //
+// + Kamil Dzielinski aka Brego + //
+// +------------------------------------------------------------------+ //
+// + Licensed under The MIT License + //
+// + Redistributions of files must retain the above copyright notice. + //
+// + See: http://www.opensource.org/licenses/mit-license.php + //
+//////////////////////////////////////////////////////////////////////////
+
+/**
+ * Purpose: Dispatcher
+ * Dispatches the request, creating aproppriate models and controllers.
+ *
+ * @filesource
+ * @author Cake Authors/Developers
+ * @copyright Copyright (c) 2005, Cake Authors/Developers
+ * @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
+ * @package cake
+ * @subpackage cake.libs
+ * @since Cake v 0.2.9
+ * @version $Revision$
+ * @modifiedby $LastChangedBy$
+ * @lastmodified $Date$
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+
+define('DISPATCH_NO_CONTROLLER', 'missingController');
+define('DISPATCH_UNKNOWN_CONTROLLER', 'missingController');
+define('DISPATCH_NO_ACTION', 'missingAction');
+define('DISPATCH_UNKNOWN_ACTION', 'missingAction');
+define('DISPATCHER_UNKNOWN_VIEW', 'missingView');
+
+uses('error_messages', 'object', 'router', 'controller');
+
+/**
+ * Dispatches the request, creating appropriate models and controllers.
+ *
+ * @package cake
+ * @subpackage cake.libs
+ * @since Cake v 0.2.9
+ */
+class Dispatcher extends Object
+{
+ /**
+ * Base URL
+ * @var string
+ */
+ var $base = false;
+
+ /**
+ * Fetches base url.
+ */
+ function __construct()
+ {
+ $this->base = $this->baseUrl();
+ parent::__construct();
+ }
+
+ /**
+ * Dispatches the request (action).
+ *
+ * @param string $url
+ * @return array
+ */
+ function dispatch($url)
+ {
+ $params = $this->parseParams($url);
+ $result = $this->invoke($url);
+
+ return $result === true? $params: array();
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param string $url
+ * @return unknown
+ */
+ function invoke($url)
+ {
+ global $_POST, $_GET, $_FILES, $_SESSION;
+
+ $params = $this->parseParams($url);
+ $missingController = false;
+ $missingAction = false;
+ $missingView = false;
+
+ if (empty($params['controller']))
+ {
+ $missingController = true;
+ }
+ else
+ {
+ $ctrlName = Inflector::camelize($params['controller']);
+ $ctrlClass = $ctrlName.'Controller';
+
+ if (!loadController($ctrlName) || !class_exists($ctrlClass))
+ {
+ $missingController = true;
+ }
+ }
+
+ if ($missingController)
+ {
+ $ctrlClass = 'AppController';
+ $controller = new $ctrlClass($this);
+ $params['action'] = 'missingController';
+ $controller->missingController = $params['controller'];
+ }
+ else
+ {
+ // create controller
+ $controller = new $ctrlClass($this);
+ }
+
+ // if action is not set, and the default Controller::index() method doesn't exist
+ if (empty($params['action']))
+ {
+ if (method_exists($controller, 'index'))
+ {
+ $params['action'] = 'index';
+ }
+ else
+ {
+ $missingAction = true;
+ }
+ }
+
+ // if the requested action doesn't exist
+ if (!method_exists($controller, $params['action']))
+ {
+ $missingAction = true;
+ }
+
+ if ($missingAction)
+ {
+ $controller->missingAction = $params['action'];
+ $params['action'] = 'missingAction';
+ }
+
+ // initialize the controller
+ $controller->base = $this->base;
+ $controller->here = $this->base.'/'.$url;
+ $controller->params = $params;
+ $controller->action = $params['action'];
+ $controller->data = empty($params['data'])? null: $params['data'];
+ //$controller->passed_args = empty($params['pass'])? null: $params['pass'];
+
+ // EXECUTE THE REQUESTED ACTION
+ call_user_func_array(array(&$controller, $params['action']), empty($params['pass'])? null: $params['pass']);
+
+ $isFatal = isset($controller->isFatal) ? $controller->isFatal : false;
+
+ if ($isFatal)
+ {
+ switch($params['action'])
+ {
+ case 'missingController':
+ $this->errorUnknownController($url, $ctrlName);
+ break;
+
+ case 'missingAction':
+ $this->errorUnknownAction($url, $ctrlClass, $controller->missingAction);
+ break;
+ }
+ }
+
+ if ($controller->autoRender)
+ {
+ $controller->render();
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns array of GET and POST parameters. GET parameters are taken from given URL.
+ *
+ * @param string $from_url
+ * @return array Parameters found in POST and GET.
+ */
+ function parseParams($from_url)
+ {
+ global $_POST, $_FILES;
+
+ // load routes config
+ $Route = new Router();
+ include CONFIGS.'routes.php';
+ $params = $Route->parse ($from_url);
+
+ // add submitted form data
+ $params['form'] = $_POST;
+ if (isset($_POST['data']))
+ {
+ $params['data'] = $_POST['data'];
+ }
+
+ foreach ($_FILES as $name => $data)
+ {
+ $params['form'][$name] = $data;
+ }
+
+ return $params;
+ }
+
+ /**
+ * Returns a base URL.
+ *
+ * @return string
+ */
+ function baseUrl()
+ {
+ global $_SERVER;
+
+ //non mod_rewrite use:
+ if (defined('BASE_URL')) return BASE_URL;
+
+ $doc_root = $_SERVER['DOCUMENT_ROOT'];
+ $script_name = $_SERVER['PHP_SELF'];
+
+ // if document root ends with 'public', it's probably correctly set
+ $r = null;
+ if (ereg('/^.*/public(\/)?$/', $doc_root))
+ return preg_match('/^(.*)\/index\.php$/', $script_name, $r)? $r[1]: false;
+ else
+ // document root is probably not set to Cake 'public' dir
+ return preg_match('/^(.*)\/public\/index\.php$/', $script_name, $r)? $r[1]: false;
+ }
+
+ /**
+ * Displays an error page (e.g. 404 Not found).
+ *
+ * @param int $code Error code (e.g. 404)
+ * @param string $name Name of the error message (e.g. Not found)
+ * @param string $message
+ */
+ function error ($code, $name, $message)
+ {
+ $controller = new Controller ($this);
+ $controller->base = $this->base;
+ $controller->error($code, $name, $message);
+ }
+
+ /**
+ * Convenience method to display a 404 page.
+ *
+ * @param unknown_type $url
+ * @param unknown_type $message
+ */
+ function error404 ($url, $message)
+ {
+ $this->error('404', 'Not found', sprintf(ERROR_404, $url, $message));
+ }
+
+ /**
+ * If DEBUG is set, this displays a 404 error with the message that no controller is set. If DEBUG is not set, nothing happens.
+ *
+ * @param string $url
+ */
+ function errorNoController ($url)
+ {
+ DEBUG?
+ trigger_error (ERROR_NO_CONTROLLER_SET, E_USER_ERROR):
+ $this->error404($url, "no controller set");
+ exit;
+ }
+
+ /**
+ * If DEBUG is set, this displays a 404 error with the message that the asked-for controller does not exist. If DEBUG is not set, nothing happens.
+ *
+ * @param string $url
+ * @param string $controller_class
+ */
+ function errorUnknownController ($url, $controller_class)
+ {
+ DEBUG?
+ trigger_error (sprintf(ERROR_UNKNOWN_CONTROLLER, $controller_class), E_USER_ERROR):
+ $this->error404($url, "missing controller \"{$controller_class}\"");
+ exit;
+ }
+
+ /**
+ * If DEBUG is set, this displays a 404 error with the message that no action is set. If DEBUG is not set, nothing happens.
+ *
+ * @param string $url
+ */
+ function errorNoAction ($url)
+ {
+ DEBUG?
+ trigger_error (ERROR_NO_ACTION_SET, E_USER_ERROR):
+ $this->error404(sprintf(ERROR_404, $url, "no action set"));
+ exit;
+ }
+
+ /**
+ * If DEBUG is set, this displays a 404 error with the message that no such action exists. If DEBUG is not set, nothing happens.
+ *
+ * @param string $url
+ * @param string $controller_class
+ * @param string $action
+ */
+ function errorUnknownAction ($url,$controller_class, $action)
+ {
+ DEBUG?
+ trigger_error (sprintf(ERROR_NO_ACTION, $action, $controller_class), E_USER_ERROR):
+ $this->error404($url, "missing controller \"{$controller_class}\"");
+ exit;
+ }
+}
+
+?>
diff --git a/libs/helpers/ajax.php b/libs/helpers/ajax.php
new file mode 100644
index 000000000..2d3b07ce4
--- /dev/null
+++ b/libs/helpers/ajax.php
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/libs/helpers/html.php b/libs/helpers/html.php
new file mode 100644
index 000000000..c03456b44
--- /dev/null
+++ b/libs/helpers/html.php
@@ -0,0 +1,576 @@
+ + //
+// + Copyright: (c) 2005, Cake Authors/Developers + //
+// + Author(s): Michal Tatarynowicz aka Pies + //
+// + Larry E. Masters aka PhpNut + //
+// + Kamil Dzielinski aka Brego + //
+// +------------------------------------------------------------------+ //
+// + Licensed under The MIT License + //
+// + Redistributions of files must retain the above copyright notice. + //
+// + See: http://www.opensource.org/licenses/mit-license.php + //
+//////////////////////////////////////////////////////////////////////////
+
+/**
+ * Purpose: Dispatcher
+ * Dispatches the request, creating aproppriate models and controllers.
+ *
+ * @filesource
+ * @author Cake Authors/Developers
+ * @copyright Copyright (c) 2005, Cake Authors/Developers
+ * @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
+ * @package cake
+ * @subpackage cake.libs
+ * @since Cake v 0.2.9
+ * @version $Revision$
+ * @modifiedby $LastChangedBy$
+ * @lastmodified $Date$
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+
+class HtmlHelper
+{
+ /**
+ * Returns given string trimmed to given length, adding an ending (default: "..") if necessary.
+ *
+ * @param string $string String to trim
+ * @param integer $length Length of returned string, excluding ellipsis
+ * @param string $ending Ending to be appended after trimmed string
+ * @return string Trimmed string
+ */
+ function trim($string, $length, $ending='..')
+ {
+ return substr($string, 0, $length).(strlen($string)>$length? $ending: null);
+ }
+
+ /**
+ * Returns an URL for a combination of controller and action.
+ *
+ * @param string $url
+ * @return string Full constructed URL as a string.
+ */
+ function url($url=null)
+ {
+ global $controller;
+
+ if (empty($url))
+ {
+ return $controller->here;
+ }
+ elseif ($url[0] == '/')
+ {
+ $out = $controller->base . $url;
+ }
+ else
+ {
+ $out = $controller->base . '/' . strtolower($controller->params['controller']) . '/' . $url;
+ }
+
+ return ereg_replace('&([^a])', '&\1', $out);
+ }
+
+ /**
+ * Returns a space-separated string with items of the $options array.
+ *
+ * @param array $options Array of HTML options.
+ * @param string $insert_before
+ * @param unknown_type $insert_after
+ * @return string
+ */
+ function parseHtmlOptions($options, $exclude=null, $insert_before=' ', $insert_after=null)
+ {
+ if (!is_array($exclude)) $exclude = array();
+
+ if (is_array($options))
+ {
+ $out = array();
+ foreach ($options as $k=>$v)
+ {
+ if (!in_array($k, $exclude))
+ {
+ $out[] = "{$k}=\"{$v}\"";
+ }
+ }
+ $out = join(' ', $out);
+ return $out? $insert_before.$out.$insert_after: null;
+ }
+ else
+ {
+ return $options? $insert_before.$options.$insert_after: null;
+ }
+ }
+
+ /**
+ * Returns an HTML link to $url for given $title, optionally using $html_options and $confirm_message (for "flash").
+ *
+ * @param string $title The content of the A tag.
+ * @param string $url
+ * @param array $html_options Array of HTML options.
+ * @param string $confirm_message Message to be shown in "flash".
+ * @return string
+ */
+ function linkTo($title, $url, $html_options=null, $confirm_message=false)
+ {
+ $confirm_message? $html_options['onClick'] = "return confirm('{$confirm_message}')": null;
+ return sprintf(TAG_LINK, $this->url($url), $this->parseHtmlOptions($html_options), $title);
+ }
+
+ /**
+ * Returns an external HTML link to $url for given $title, optionally using $html_options.
+ * The ereg_replace is to replace the '&' in the URL into & for XHTML purity.
+ *
+ * @param string $title
+ * @param string $url
+ * @param array $html_options
+ * @return string
+ */
+ function linkOut($title, $url=null, $html_options=null)
+ {
+ $url = $url? $url: $title;
+ return sprintf(TAG_LINK, ereg_replace('&([^a])', '&\1', $url), $this->parseHtmlOptions($html_options), $title);
+ }
+
+ /**
+ * Returns an HTML FORM element.
+ *
+ * @param string $target URL for the FORM's ACTION attribute.
+ * @param string $type FORM type (POST/GET).
+ * @param array $html_options
+ * @return string An formatted opening FORM tag.
+ */
+ function formTag($target=null, $type='post', $html_options=null)
+ {
+ $html_options['action'] = $this->UrlFor($target);
+ $html_options['method'] = $type=='get'? 'get': 'post';
+ $type == 'file'? $html_options['enctype'] = 'multipart/form-data': null;
+
+ return sprintf(TAG_FORM, $this->parseHtmlOptions($html_options, null, ''));
+ }
+
+ /**
+ * Returns a generic HTML tag (no content).
+ *
+ * Examples:
+ * * tag("br") =>
+ * * tag("input", array("type" => "text")) =>
+ *
+ * @param string $name Name of HTML element
+ * @param array $options HTML options
+ * @param bool $open Is the tag open or closed? (defaults to closed "/>")
+ * @return string The formatted HTML tag
+ */
+ function tag($name, $options=null, $open=false)
+ {
+ $tag = "<$name ". $this->parseHtmlOptions($options);
+ $tag .= $open? ">" : " />";
+ return $tag;
+ }
+
+ /**
+ * Returns a generic HTML tag with content.
+ *
+ * Examples:
+ * * content_tag("p", "Hello world!") =>