2017 © Pedro Peláez
 

symfony-bundle view-helpers-bundle

General-purpose view helpers for PHP templating engine from Chillout Development.

image

chilldev/view-helpers-bundle

General-purpose view helpers for PHP templating engine from Chillout Development.

  • Monday, June 30, 2014
  • by rafal.wrzeszcz
  • Repository
  • 2 Watchers
  • 2 Stars
  • 1,613 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

ChillDev ViewHelpers bundle

ChillDevViewHelpersBundle is a Symfony2 bundle that brings set of useful view helpers for PHP templating engine., (*1)

Build Status Scrutinizer Quality Score Coverage Status Dependency Status SensioLabsInsight, (*2)

Because not everyone uses Twig…, (*3)

Installation

This bundle is provided as Composer package. To install it simply add following dependency definition to your composer.json file:, (*4)

"chilldev/view-helpers-bundle": "dev-master"

Replace dev-master with different constraint if you want to use specific version., (*5)

Note: This bundle requires PHP 5.4., (*6)

Configuration

All you need to do in order to use this bundle's goods is to load it in your kernel:, (*7)

`, `` etc. Here is sample usage:

In your view file:

```php
extend('::layout.html.php'); ?>

append($page->getName()); ?>
getMetaName('keywords')->append($page->getKeywords()); ?>
setMetaName('description', \strip_tags($page->getDescription())); ?>
setProperty('og:title', $page->getName()); ?>
add('http://example.com/page-2-slug.html', 'next'); ?>
add('/javascript/prototype.js'); ?>

truncate($text, 255); ?>, (*8)

In your layout file:, (*9)

<!DOCTYPE html>
<html<?php echo $view['xmlns']; ?>>
    <head>
        <?php echo $view['title']; ?>
        <?php echo $view['meta']; ?>
        <?php echo $view['link']; ?>
        <?php echo $view['script']; ?>
    </head>
    <body>
        <?php $view['slots']->output('_content') ?>
    </body>
</html>

For more advanced aspects see advanced usage documentation or even internals description., (*10)

Extras

There are also some extra resources included in this bundle that can be useful for your PHP-templates-based project., (*11)

KnpPaginatorBundle supports PHP templating, but lacks default template for paginator helper. You can use one from this bundle with just following one setting in your application configuration:, (*12)

# KNP paginator configuration
knp_paginator:
    template:
        pagination: "ChillDevViewHelpersBundle:Pagination:sliding.html.php"

Another additional enchantment to PHP templating engine provided by this bundle is possibility to define global templating variables. This feature is available out of the box for Twig templating engine in Symfony (with TwigBundle), but there is no equivalent for native PHP templates. Now, with our bundle you can do:, (*13)

chilldev_viewheleprs:
    globals:
        values:
            slogan: "The best page ever!"
        services:
            sms: "your.sms.service"

And use it directly in templates:, (*14)

<h1><?php echo $slogan; ?></h1>
<p><?php echo $sms->getGatewayNumber(); ?></p>

Resources

Contributing

Do you want to help improving this project? Simply fork it and post a pull request. You can do everything on your own, you don't need to ask if you can, just do all the awesome things you want!, (*15)

This project is published under MIT license., (*16)

Authors

ChillDevViewHelpersBundle is brought to you by Chillout Development., (*17)

List of contributors:, (*18)

The Versions

01/02 2013

0.1.2

0.1.2.0 http://chilloutdevelopment.github.com/ChillDevViewHelpersBundle

General-purpose view helpers for PHP templating engine from Chillout Development.

  Sources   Download

MIT

The Requires

 

The Development Requires

templating php helper symfony2 markup paginator view helpers chilldev xhtml

01/01 2013
01/01 2013
20/11 2012