Giter Club home page Giter Club logo

fmbbcodebundle's Introduction

PHP-Decoda integration in Symfony2

A lightweight lexical string parser for BBCode styled markup.

Installation

Install PHP-Decoda

Download

With submodule: git submodule add git://github.com/milesj/php-decoda.git vendor/php-decoda

With clone: git clone git://github.com/milesj/php-decoda.git vendor/php-decoda

Using the vendors script

Add the following lines in your deps file::

[php-decoda]
git=http://github.com/milesj/php-decoda.git

Run the vendors script::

./bin/vendors install

Register autoloading

// app/autoload.php

$loader->registerPrefixes(array(
    ...
    'Decoda' => __DIR__.'/../vendor/php-decoda/decoda',
));

Install FMBbCodeBundle

Download

With submodule: git submodule add git://github.com/helios-ag/FMBbCodeBundle.git vendor/bundles/FM/BbCodeBundle

With clone: git clone git://github.com/helios-ag/FMBbCodeBundle vendor/bundles/FM/BbCodeBundle

Using the vendors script

Add the following lines in your deps file::

[FMBbCodeBundle]
git=http://github.com/helios-ag/FMBbCodeBundle.git

Run the vendors script::

./bin/vendors install

Register autoloading

// app/autoload.php

$loader->registerNamespaces(array(
    ...
    'FM' => __DIR__.'/../vendor/bundles',
    // your other namespaces
));

Register the bundle

// app/AppKernel.php

public function registerBundles()
{
    return array(
        // ...
        new FM\BbCodeBundle\FMBbCodeBundle(),
        // ...
    );
}

Basic configuration

Make the Twig extensions available by updating your configuration:

this is mandatory parameters:

fm_bb_code: locale: ru-ru

By default only "default" filter enabled, which provide support
for [b], [i], [u], [s], [sub], [sup] BBCodes

Examples to use the extension in your Twig template

 {{'[b]Bold text[/b]'|BBCode}}
 {{'[u]Underlined text[/u]'|BBCode}}
 {{'[i]Italic text[/i]'|BBCode}}

 After enabling "quote" filter, you can do such things:

  {{'[quote="helios"]My quote[/quote]'|BBCode}}

Full tree of parameters

fm_bb_code:
  # language code or 'default' to set it from the session 
  locale: ru-ru
  xhtml: true
  filters:
    default: enabled
    block: enabled
    code: enabled
    email: enabled
    image: enabled
    list: enabled
    quote: enabled
    text: enabled
    url: enabled
    video: enabled

TODO:

Add support of whitelist tags and hooks.

fmbbcodebundle's People

Contributors

helios-ag avatar idetia avatar olleyyy avatar slider avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.