Html Helper
link_to()
$this->link_to($name, array( $url_options = array(), $html = array() ))
Example
= $this->link_to('Link', array('url' => array('action' => 'my_action', 'controller' => 'my_controller', 'id' => '1', 'param' => 'param'),
'html' => array('class' => 'link_class')))
Html
<a class="link_class" href="/my_controller/my_action/1¶m=param">Link</a>
link_to_remote()
$this->link_to_remote($name, array( $url_options = array(), $ajax_options = array(), $html = array() ))
Example
= $this->link_to_remote('Link', array('url' => array('action' => 'my_action', 'controller' => 'my_controller', 'id' => '1', 'param' => 'param'),
'ajax' => array('update' => 'div'),
'html' => array('class' => 'link_class')))
Html
<a id="link_id" class="link_class" onclick="new Ajax.Updater(" href="#">Link</a>
* Available options for $ajax_options
- loading - loaded - success - failure - complete - interactive - before - after - condition - submit - confirm
link_to_function()
$this->link_to_funtion($name, array( $options = array() ))
Example
= $this->link_to_function('Link', array('onclick' => 'function()',
'html' => array('class' => 'link_class')))
Html
<a class="link_class" onclick="function();" href="#">Link</a>
button_to()
$this->button_to($name, array( $url_options = array(), $html = array() ))
Example
= $this->button_to('Button', array('url' => array('action' => 'my_action', 'controller' => 'my_controller', 'id' => '1', 'param' => 'param'),
'html' => array('class' => 'link_class')))
Html
<button class="link_class" onclick="window.location="/my_controller/my_action/1¶m=param"">Button</button>
button_to_remote()
$this->button_to_remote($name, array( $url_options = array(), $ajax_options = array(), $html = array() ))
Example
= $this->html->button_to_remote('button', array('url' => array('action' => 'div', 'controller' => 'user', 'id' => '1'),
'html' => array('style' => 'color:red;'),
'ajax' => array( 'success' => '$("div").hide();')))
Html
<button style="color: red;" onclick="new Ajax.Request(">Button</button>
* Available options for $ajax_options
- loading - loaded - success - failure - complete - interactive - before - after - condition - submit - confirm
button_to_function()
$this->button_to_funtion($name, array( $options = array() ))
Example
= $this->button_to_function('Button', array('onclick' => 'function()',
'html' => array('class' => 'link_class')))
Html
<button class="link_class" onclick="function();">Link</button>
mail_to()
$this->mail_to($name, array( $url_options = array(), $html = array() ))
Example
= $this->html->mail_to('Mail_to', array( 'url' => array('mailto' => 'email@to.com'),
'html' => array('class' => 'link_class', 'id' => 'link_id')))
Html
<a id="link_id" class="link_class" href="mailto:email@to.com">Link</a>
image_tag()
$this->image_tag($name, array( $html = array() ))
Example
= $this->html->image_tag('image.jpg', array('html' => array('border' => '0'))) ?
Html
<img src="/public/images/image.jpg" border="0" alt="" />
form_tag()
= $this->html->form_tag(array( $url_options array(), $html_options = array() ))
Example
= $this->html->form_tag(array( 'url' => array('action' => 'my_action', 'controller' => 'my_controller', 'id' => '1', 'param' => 'param'),
'html' => array('id' => 'form_id')))
Html
<form id="form_id" action="/my_controller/my_action/1¶m=param" method="post"></form> <strong>form_remote_tag()</strong> <pre>= $this->html->form_tag(array( $url_options array(), $ajax_options = array(), $html_options = array() ))
Example
= $this->html->form_tag(array( 'url' => array('action' => 'my_action', 'controller' => 'my_controller', 'id' => '1', 'param' => 'param'),
'ajax' => array('update' => 'div'),
'html' => array('id' => 'form_id')))
Html
* Available options for $ajax_options
- loading - loaded - success - failure - complete - interactive
submit_tag()
submit_tag($name, $html_options = array ())
Example
= $this->html->submit_tag('Submit');
Html
<input type="submit" value="Submit" />
submit_image_tag()
submit_image_tag($image_file, $html_options = array ())
Example
= $this->html->submit_image_tag('image.jpg');
Html
<input src="/public/images/image.jpg" type="image" />
End_form_tag()
$this->end_form_tag()
Html
text_field()
text_field($field_name, $html_options = array ())
Example
text_field('tableName[columnName]', array ('class' => 'my_class', 'disabled' => 'disabled', 'value' => 'data'))
Html
<input id="tableName_columnName" class="my_class" disabled="disabled" name="tableName[columnName]" type="text" value="data" />
file_field()
file_field($field_name, $html_options = array ())
Example
file_field('tableName[columnName]', array ('class' => 'my_class'))
Html
<input id="tableName_columnName" class="my_class" name="tableName[columnName]" type="text" />
password_field()
text_field($field_name, $html_options = array ())
Example
password_field('tableName[columnName]', array ('class' => 'my_class', 'disabled' => 'disabled', 'value' => 'data'))
Html
<input id="tableName_columnName" class="my_class" disabled="disabled" name="tableName[columnName]" type="password" value="data" />
hidden_field()
hidden_field($field_name, $html_options = array ())
Example
= hidden_field('tableName[columnName]', array ('value' => 'data'))
Html
<input id="tableName_columnName" name="tableName[columnName]" type="hidden" value="data" />
radio_field()
radio($field_name, $html_options = array ())
Example
= $this->html->radio('tableName[columnName]', array('checked' => 'checked', 'disabled' => 'disabled'));
Html
<input id="tableName_columnName" checked="checked" disabled="disabled" name="tableName[ColumnName]" type="radio" />
check_box()
check_box($field_name, $html_options = array ())
Example
= $this->html->check_box('tableName[columnName]', array('checked' => 'checked', 'disabled' => 'disabled'));
Html
<input id="tableName_columnName" checked="checked" disabled="disabled" name="tableName[ColumnName]" type="check_box" />
text_area()
text_area($field_name, $html_options = array ())
Example
= $this->html->text_area('tabeName[description]', array('class' => 'my_class' , 'value' => 'data', 'disabled' => 'disabled'))
Html
<textarea id="tableName_columnName" class="my_class" disabled="disabled" name="tableName[columnName]">data</textarea>
select()
= select($field_name, $collection = array (), $options = array ())
Example
= $this->html->select('user[type]',array('object' => $tasks ,'id/name',
'select' => '4',
'before' => array('elow' => 'elow'),
'after' => array('elow1' => 'elow1')),
array('style' => 'border:1px solid;'))
* If you need to use some helper function for name field for example truncate() , you can specify it like this
= $this->html->select('user[type]',array('object' => $tasks ,'id/truncate(name,20)' ...
option_for_select()
= $this->option_for_select($collection = array())
* This method generate for select tag
Example
= $this->html->options_for_select(array('before' => array('elow' => 'elow'),
'object' => $tasks ,'id/name',
'after' => array('elow1' => 'elow1'),
'select' => '4'))
draggable_element()=
= $this->html->draggable_element($id)
Example
= $this->html->draggable_element('divbox')
drop_receiving_element()=
= $this->html->drop_receiving_element($id, $options => array() )
Example
= $this->html->drop_receiving_element('my_cart', array('url' => array('action' => 'add', 'controller' => 'cart')))
country_select()
function country_select($field_name, $priority_countries = null, $options = array (), $html_options = array ())
options_for_select()
options_for_select($collection, $selected = null)
select_datetime()
select_datetime($field_name, $options = array (), $html_options = array ())
select_day()
select_day($field_name, $options = array (), $html_options = array ())
select_month()
select_month($field_name, $options = array (), $html_options = array ())
select_year()
select_year($field_name, $options = array (), $html_options = array ())
select_hour()
select_hour($field_name, $options = array (), $html_options = array ())
select_minute()
select_minute($field_name, $options = array (), $html_options = array ())
select_second
select_second($field_name, $options = array (), $html_options = array ())
time_ago_in_words()
time_ago_in_words($from_time, $include_seconds = false)
distance_of_time_in_words()
distance_of_time_in_words($from_time, $to_time = 0, $include_seconds = false) {
