[ Index ]

PHP Cross Reference of Akelos Framework

title

Body

[close]

/AkActionView/helpers/ -> tag_helper.php (summary)

(no description)

Author: Bermi Ferrer
Copyright: Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org
License: GNU Lesser General Public License
File Size: 117 lines (4 kb)
Included or required: 5 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

TagHelper:: (6 methods):
  tag()
  content_tag()
  cdata_section()
  escape_once()
  _fix_double_escape()
  _tag_options()


Class: TagHelper  - X-Ref

Use these methods to generate HTML tags programmatically when you can't use a Builder.
By default, they output XHTML compliant tags.

tag($name, $options = null, $open = false)   X-Ref
Returns an empty HTML tag of type *name* which by default is XHTML
compliant. Setting *open* to true will create an open tag compatible
with HTML 4.0 and below. Add HTML attributes by passing an attributes
array to *options*. For attributes with no value like (disabled and
readonly), give it a value of true in the *options* array.

Examples:

<%= tag 'br' %>
# => <br />
<%= tag 'br', null, true %>
# => <br>
<%= tag 'input', { :type => 'text', :disabled => true } %>
# => <input type="text" disabled="disabled" />

content_tag($name, $content, $options = null)   X-Ref
Returns an HTML block tag of type *name* surrounding the *content*. Add
HTML attributes by passing an attributes array to *options*. For attributes
with no value like (disabled and readonly), give it a value of true in
the *options* array. You can use symbols or strings for the attribute names.

<%= content_tag 'p', 'Hello world!' %>
# => <p>Hello world!</p>
<%= content_tag('div', content_tag('p', "Hello world!"), :class => "strong") %>
# => <div class="strong"><p>Hello world!</p></div>
<%= content_tag("select", options, :multiple => true) %>
# => <select multiple="multiple">...options...</select>

cdata_section($content)   X-Ref
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
<tt>&lt;![CDATA[</tt> and } with (and may not contain) the string
<tt>]]></tt>.


escape_once($html)   X-Ref
Returns the escaped +html+ without affecting existing escaped entities.

<%= escape_once "1 > 2 &amp; 3" %>
# => "1 &gt; 2 &amp; 3"

_fix_double_escape($escaped)   X-Ref
Fix double-escaped entities, such as &amp;amp;, &amp;#123;, etc.


_tag_options($options)   X-Ref
No description



Generated: Mon Oct 27 12:43:49 2008 Cross-referenced by PHPXref 0.6