[ Index ]
 

Code source de PHPonTrax 2.6.6-svn

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/vendor/trax/action_view/ -> helpers.php (sommaire)

File containing the Helpers class and associated functions (PHP 5)

Copyright: (c) 2005 John Peterson
Version: $Id: helpers.php 233 2006-07-28 11:18:21Z john $
Poids: 374 lignes (12 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

Helpers:: (14 méthodes):
  __construct()
  value()
  object()
  tag_options()
  convert_options()
  boolean_attribute()
  cdata_section()
  tag()
  content_tag()
  to_content_tag()
  error_wrapping()
  content_tag()
  tag()
  cdata_section()


Classe: Helpers  - X-Ref

Basic helper functions

A collection of methods used to generate basic HTML/XML.
__construct($object_name = null, $attribute_name = null)   X-Ref
Construct a Helpers object

param: string Name of ActiveRecord subclass
param: string Attribute of ActiveRecord subclass

value()   X-Ref
Get value of current attribute in the current ActiveRecord object

If there is a value in $_REQUEST[][], return it.
Otherwise fetch the value from the database.

object($object_name = null)   X-Ref
Given the name of an ActiveRecord subclass, find an instance

Finds the AR instance from the ActionController instance.
Assumes that if a $object_name is defined either as the
argument or an instance variable, then there must be
a controller object instance which points to a single instance
of the ActiveRecord.
<b>FIXME:</b> Handle errors better.
param: string Name of an ActiveRecord subclass or null
return: mixed Instance of the subclass, or null if

tag_options($options)   X-Ref
Convert array of tag attribute names and values to string

param: string[] $options
return: string

convert_options($options = array()   X-Ref
Convert selected attributes to proper XML boolean form

param: string[] $options
return: string[] Input argument with selected attributes converted

boolean_attribute(&$options, $attribute)   X-Ref
Convert an attribute to proper XML boolean form

param: string[] $options
param: string $attribute
return: void Contents of $options have been converted

cdata_section($content)   X-Ref
Wrap CDATA begin and end tags around argument

Returns a CDATA section for the given content.  CDATA sections
are used to escape blocks of text containing characters which would
otherwise be recognized as markup. CDATA sections begin with the string
<samp><![CDATA[</samp> and end with (and may not contain) the string
<samp>]]></samp>.
param: string $content  Content to wrap
return: string          Wrapped argument

tag($name, $options = array()   X-Ref
Generate an HTML or XML tag with optional attributes and self-ending

<ul>
<li>Example: <samp>tag("br");</samp><br>
Returns: <samp><br  />\n</samp></li>
<li> Example: <samp>tag("div", array("class" => "warning"), true);</samp><br>
Returns: <samp><div class="warning">\n</samp></li>
</ul>
param: string $name      Tag name
param: string[] $options Tag attributes to apply, specified as
param: boolean $open
return: string The generated tag, followed by "\n"

content_tag($name, $content, $options = array()   X-Ref
Generate an open/close pair of tags with optional attributes and content between

<ul>
<li>Example: <samp>content_tag("p", "Hello world!");</samp><br />
Returns: <samp><p>Hello world!</p>\n</samp><li>
<li>Example:
<samp>content_tag("div",
content_tag("p", "Hello world!"),
array("class" => "strong"));</samp><br />
Returns:
<samp><div class="strong"><p>Hello world!</p></div>\n</samp></li>
</ul>
param: string $name    Tag to wrap around $content
param: string $content Text to put between tags
param: string[] $options Tag attributes to apply, specified as
return: string Text wrapped with tag and attributes,

to_content_tag($tag_name, $options = array()   X-Ref


error_wrapping($html_tag, $has_error)   X-Ref
If this tag has an error, wrap it with a visual indicator

param: string HTML to be wrapped
param: boolean  true=>error, false=>no error
return: string

content_tag()   X-Ref
Create a Helpers object and call its content_tag() method

param: string $name    Tag to wrap around $content
param: string $content Text to put between tags
param: string[] $options Tag attributes to apply
return: string Text wrapped with tag and attributes,

tag()   X-Ref
Create a Helpers object and call its tag() method

param: string $name    Tag name
param: string[] $options Tag attributes to apply
param: boolean $open
return: string The tag, followed by "\n"

cdata_section()   X-Ref
Create a Helpers object and call its cdata_section() method




Généré le : Sun Feb 25 20:04:38 2007 par Balluche grâce à PHPXref 0.7