zerkalica/millwrightboilerplatebundle

Symfony2 Millwright boilerplate bundle

dev-master 2012-11-24 19:40 UTC

This package is not auto-updated.

Last update: 2024-12-21 15:44:28 UTC


README

Base html layout and content twig helpers

Inspired by OryzoneBoilerplateBundle(https://github.com/Oryzone/OryzoneBoilerplateBundle)

Features

Installation

php composer.phar update zerkalica/millwright-boilerplate-bundle
php composer.phar update manymules/jquery-bundle
php composer.phar update manymules/modernizr-bundle

Add bundle to your application kernel

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new ManyMules\JQueryBundle\ManyMulesJQueryBundle,
        new ManyMules\ModernizrBundle\ManyMulesModernizrBundle,

        new Millwright\BoilerplateBundle\MillwrightBoilerplateBundle,
        // ...
    );
}

Example

{# ::layout.html.twig #}

{% extends 'MillwrightBoilerplateBundle::layout.html.twig' %}
{% import 'MillwrightBoilerplateBundle::helpers.html.twig' as add %}

{% block body_js %}
    {{ add.chromeFrame() }}
    {{ add.googleJs('jquery/1.8.3/jquery.min.js', 'bundles/manymulesjquery/js/jquery.min.js') }}
    {{ add.googleAnalytics(bp_analytics_id|default('')) }}
{% endblock body_js %}

{% block head_js %}
    {{ add.js('bundles/manymulesmodernizr/js/modernizr.min.js' }}
{% endblock head_js %}

{% block favicon %}
    {{ add.favicon('favicon.ico') }}
{% endblock favicon %}

{% block final_css %}
    {{ add.css('twitterbootstrap/responsive.css') }}
{% endblock final_css %}
{# view.html.twig #}

{% extends '::layout.html.twig' %}
{% import 'MillwrightBoilerplateBundle::helpers.html.twig' as add %}

{% block body_content %}
    {{ parent() }}
    <div id="app"></div>
{% endblock body_content %}

{% block head_css %}
    {{ parent() }}
    {{ add.css('bundles/myapp/css/main.css') }}
{% endblock head_css %}

{% block body_js %}
    {{ parent() }}
    {{ add.js('bundles/myapp/js/main.app.js') }}
{% endblock body_js %}

{% block body_js_code %}
    {{ parent() }}
    <script>
        {{ add.readyStart() }}
            $('#app').myApp();
        {{ add.readyFinish() }}
    <script>
{% endblock body_js_code %}
#app/config/config.yml

# Twig Configuration
twig:
    debug:            %kernel.debug%
    strict_variables: %kernel.debug%
    globals:
        bp_language: %locale%