idci/contact-form-bundle

Symfony ContactFormBundle

v2.1.0 2013-06-06 15:22 UTC

This package is auto-updated.

Last update: 2024-08-24 20:34:06 UTC


README

Symfony2 联系表单包和社交分享

安装

要安装此包,请按照以下步骤操作

首先,将依赖项添加到您的 composer.json 文件中

"require": {
    ...
    "pagerfanta/pagerfanta": "dev-master",
    "white-october/pagerfanta-bundle": "dev-master",
    "idci/contact-form-bundle": "dev-master"
},

然后,使用以下命令安装包

php composer update

在您的应用程序内核中启用该包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
        new IDCI\Bundle\ContactFormBundle\IDCIContactFormBundle(),
    );
}

如您所见,我们使用 WhiteOctoberPagerFantaBundle 来分页列表结果。因此,您必须在 app/config/parameters.yml 中定义 max_per_page 参数

parameters:
    ...
    max_per_page:  25

app/config/routing.yml 中添加所需的路由,以便在任何地方使用此包的所有表单

idci_contact_form_api:
    resource: "../../vendor/idci/contact-form-bundle/IDCI/Bundle/ContactFormBundle/Controller/ApiController.php"
    type:     annotation

如果您希望访问管理空间,请添加以下控制器

idci_contact_form_admin:
    resource: "../../vendor/idci/contact-form-bundle/IDCI/Bundle/ContactFormBundle/Controller/AdminController.php"
    type:     annotation
    prefix:   /admin

idci_contact_form_admin_source:
    resource: "../../vendor/idci/contact-form-bundle/IDCI/Bundle/ContactFormBundle/Controller/AdminSourceController.php"
    type:     annotation
    prefix:   /admin

idci_contact_form_admin_message:
    resource: "../../vendor/idci/contact-form-bundle/IDCI/Bundle/ContactFormBundle/Controller/AdminMessageController.php"
    type:     annotation
    prefix:   /admin

如果您想查看表单演示,可以添加联系演示控制器

idci_contact_form_demo:
    resource: "../../vendor/idci/contact-form-bundle/IDCI/Bundle/ContactFormBundle/Controller/DemoController.php"
    type:     annotation
    prefix:   /contact-demo

此外,您还可以简单地声明一个路由,该路由将包含所有控制器

idci_contact_form:
    resource: "../../vendor/idci/contact-form-bundle/IDCI/Bundle/ContactFormBundle/Controller"
    type:     annotation
    prefix:   /contact-form

现在,包已安装。

app/config/parameters.yml 中配置您的数据库参数,然后运行

php app/console doctrine:schema:update --force