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)

<!--[if !supportLists]-->l <!--[endif]-->$sf_context:全部的上下文对象(sfContext实例)

<!--[if !supportLists]-->l <!--[endif]-->$sf_request:请求对象(sfRequest实例)

<!--[if !supportLists]-->l <!--[endif]-->$sf_params:请求参数

<!--[if !supportLists]-->l <!--[endif]-->$sf_user:但前用户Session对象(sfUser实例)

// 长格式

<?php echo $sf_request->getParameter('total'); ?>

// 短格式

<?php echo $sf_params->get('total'); ?>

// 等价动作中下面的代码

echo $this->getRequestParameter('total');

<?php echo object_select_tag($product, 'getProductclassId', array (
'related_class' => 'ProductClass',
'text_method' => 'getName', //显示的名称
'include_blank' => true,
)) ?>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值