Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vjousse/taghelperbundle

Symfony 2 tag helper, will convert $view->tag->tag('div#test.toto', 'foo'); to <div id="test" class="toto">foo</div>
https://github.com/vjousse/taghelperbundle

Last synced: about 1 month ago
JSON representation

Symfony 2 tag helper, will convert $view->tag->tag('div#test.toto', 'foo'); to <div id="test" class="toto">foo</div>

Awesome Lists containing this project

README

        

TagHelperBundle
========================================================

Overview
--------

Just a simple Bundle which allow you to use the Diem tag helper in a Symfony2 project. See http://diem-project.org/diem-5-0/doc/en/reference-book/template-helpers#tag-helpers:_tag-create-a-tag for more details.

Basically this code :

[php]
echo $view['tag']->tag('div#test.toto', 'Foo');

Will output :

`

Foo
`

Requirements
------------

You will need the PR3 version of Symfony2. You can get the sandbox from github here: http://github.com/symfony/symfony-sandbox/tree/PR3

Installation
------------


* Install the bundle in src/Bundle
$ cd src/Bundle
$ git clone git://github.com/vjousse/TagHelperBundle.git

* In your Application kernel (HelloKernel.php for the sandbox) your registerBundles method should be something like this:

[php]
public function registerBundles()
{
$bundles = array(
new Symfony\Framework\KernelBundle(),
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\ZendBundle\ZendBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
//new Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle(),
//new Symfony\Bundle\DoctrineMongoDBBundle\DoctrineMongoDBBundle(),
//new Symfony\Bundle\PropelBundle\PropelBundle(),
//new Symfony\Bundle\TwigBundle\TwigBundle(),
new Application\HelloBundle\HelloBundle(),
new Bundle\TagHelperBundle\TagHelperBundle(),
);

if ($this->isDebug()) {
}

return $bundles;
}

Usage
-----

In your config.yml file, you'll have to declare that you will 'use' the helper

tag.config: ~

You're done ! You can do something like this in a template:

[php]
echo $view['tag']->tag('div#test.toto', 'Foo');

It will output : `

Foo
`

Detailed documentation
----------------------

This helper is a port of the Diem tag helper, the documentation can be found here: http://diem-project.org/diem-5-0/doc/en/reference-book/template-helpers#tag-helpers:_tag-create-a-tag