SYMFONY 助手

鏈接助手系列(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)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章