| SYMFONY 助手 (Helpers) |
| 链接助手系列(Link helpers) |
|
默认已引入 |
| url_for() |
重构URL |
url_for( 'URL_raw' ) |
| link_to() |
文字链接 |
link_to('link_title', 'URL_raw' [, $options] ) |
| |
图像链接 |
link_to(image_tag('img'), 'URL_raw' [, $options] ) |
| button_to() |
按钮链接 |
button_to('link_title', 'URL_raw' [, $options] ) |
| mail_to() |
邮件链接 |
mail_to('email_address', 'address title' [, $options]) |
| 文本助手(Text helpers) |
引入声明:use_helper('Text') |
| truncate_text() |
裁切文本 |
truncate_text ($text, $length , $truncate_string = '...') |
| excerpt_text() |
选摘文本 |
excerpt_text ($text, $sentence, $radius = 100 , $truncate_string = '...') |
| highlight_text() |
加亮文本 |
highlight_text($text, $sentence [,$highlighter]) |
| simple_format_text() |
HTML编码文本 |
simple_format_text($text) |
| auto_link_text() |
智能文本链接 |
auto_link_text($text) |
| image_tag() |
图像助手 |
image_tag('image_file',[, $options] ) |
| 日期助手(Date helpers) |
引入声明:use_helper('Date') |
| format_date() |
日期格式化 |
format_date($date) |
| format_datetime() |
日期时间格式化 |
format_datetime($datetime) |
| format_daterange() |
日期区间格式化 |
format_daterange($start_date, $end_date, 'MM/yy', 'from %s to %s', 'starting from %s', until %s') |
| distance_of_time_in_words() |
时间区间 |
distance_of_time_in_words($from_time, $to_time, $include_seconds = false) |
| time_ago_in_words() |
时间过往 |
time_ago_in_words($from_time, $include_seconds = false) |
数字助手(Number Helpers)
|
引入声明: use_helper('Number') |
| format_number() |
数字格式化 |
format_number($the_number) |
| format_currency() |
货币格式化 |
format_currency($money_number,'CURRENCY_CODE') |
国际化助手(International Helpers)
|
引入声明:use_helper('I18N') |
| format_country() |
地区国际化 |
format_country('COUNTRY_CODE') |
| format_language() |
语言国际化 |
format_language('LANGUAGE_CODE') |
| 表单助手(Form Helpers) |
默认已引入 |
| form_tag() |
表单助手 |
form_tag('test/save',[, $options])…</from> |
| input_tag() |
文本框 |
input_tag('name', 'default_value') |
| textarea_tag() |
文本域 |
textarea_tag('name', 'default_content', 'size=10x20') |
| checkbox_tag() |
复选框 |
checkbox_tag('name', 'value', 'true/false') |
| radiobutton_tag() |
单选框 |
radiobutton_tag('name', 'value', 'true/false') |
| input_file_tag() |
文件域 |
input_file_tag('name') |
| input_password_tag() |
密码框 |
input_password_tag('name', 'value') |
| input_hidden_tag() |
隐藏域 |
input_hidden_tag('name', 'value') |
| submit_tag() |
提交按钮 |
submit_tag('Save') |
| submit_image_tag() |
提交图片按钮 |
submit_image_tag('submit_img') |
| select_tag() |
单选选取框 |
select_tag('select_name', options_for_select(Value_array), 'selected_value')) |
| |
多选选取框 |
select_tag('select_name', options_for_select(Value_array), selected_array,'multiple=multiple')) |
| object_input_tag() |
对象文本框 |
object_input_tag($object, $method, $options) |
| object_textarea_tag() |
对象文本域 |
object_textarea_tag($object, $method, $options) |
| object_checkbox_tag() |
对象复选框 |
object_checkbox_tag($object, $method, $options) |
| object_select_tag() |
对象选择框 |
object_select_tag($object, $method, $options) |
| select_country_tag() |
国家下拉列表 |
select_country_tag('country', 'COUNTRY_CODE') |
| JavaScript助手(JavaScript helper) |
引入声明:use_helper('Javascript') |
| link_to_function() |
Javascript链接 |
link_to_function('link_title','function_name('parameter') [,$options]) |
| javascript_tag() |
Javascript代码 |
javascript_tag(" function foobar() {...}") ?> |
| AJAX表单助手 |
从属于JavaScript助手 |
| update_element_function() |
更新页面元素 |
update_element_function('element_id', $options) |
| form_remote_tag() |
AJAX表单 |
form_remote_tag($options) ?>…</from> |
| submit_to_remote() |
AJAX表单按钮 |
submit_to_remote('ajax_submit', 'Add in AJAX', $options)) |
| observe_field() |
表单元素侦查 |
observe_field('item', $options) |
| periodically_call_remote() |
表单整体侦查 |
periodically_call_remote($options) |
|