我在me\mybundle\resources\config\routing.yml添加了以下路由:
本系统使用的是XDcms内核,在原来基础上做来相应修改 前台修改调用数据,可以使用{loop catid=栏目ID}{/loop}方式调用 主要功能: A、内容管理模型,自定义字段,更方便扩展功能。自带模型:单页模型、新闻模型、产品模型、招聘模型 B、栏目自定义,便于内容管理 C、内容模块化,二次开发更便捷。自带模块:幻灯片、QQ客服、友情链接、自定义表单(在线留言、简历管理) D、模板管理,后台
0
my_homepage:
pattern: /
defaults: { _controller: MeMyBundle:Default:index }
Bundle controller
namespace Me\MyBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
public function indexAction()
{
$form = $this->createFormBuilder()
->getForm()
;
return $this->render('MeMyBundle::index.html.twig', array(
'form' => $form->createView(),
'param1' => 'some_string_1',
'param2' => 'another string',
));
}
}
我想要在同一个form表单里创建可以重复利用的自定义的form字段,以下是利用代码
public function indexAction()
{
$paramsArr_1 = array(
'param1' => 'some_string_1',
'param2' => 'another string',
);
$paramsArr_2 = array(
'param1' => 'some_string_2',
'param2' => 'another fine string',
);
$form = $this->createFormBuilder()
->add(myCustomField, $paramsArr_1)
->add(myCustomField_2, $paramsArr_2)
->getForm()
;
return $this->render('MeMyBundle::index.html.twig', array(
'form' => $form->createView()
));
}
参考了官方文档,但是还是不会,有谁知道吗?
我在me\mybundle\resources\config\routing.yml添加了以下路由:
my_homepage:
pattern: /
defaults: { _controller: MeMyBundle:Default:index }
Bundle controller
namespace Me\MyBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
public function indexAction()
{
$form = $this->createFormBuilder()
->getForm()
;
return $this->render('MeMyBundle::index.html.twig', array(
'form' => $form->createView(),
'param1' => 'some_string_1',
'param2' => 'another string',
));
}
}
我想要在同一个form表单里创建可以重复利用的自定义的form字段,以下是利用代码
public function indexAction()
{
$paramsArr_1 = array(
'param1' => 'some_string_1',
'param2' => 'another string',
);
$paramsArr_2 = array(
'param1' => 'some_string_2',
'param2' => 'another fine string',
);
$form = $this->createFormBuilder()
->add(myCustomField, $paramsArr_1)
->add(myCustomField_2, $paramsArr_2)
->getForm()
;
return $this->render('MeMyBundle::index.html.twig', array(
'form' => $form->createView()
));
}
参考了官方文档,但是还是不会,有谁知道吗?
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号