Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
PPI SmartyEngine Plugin #27
@noisebleed is interested in making a PPI Module for registering the SmartyEngine
I have currently developed the code necessary for SmartyEngine. Futher development on this is required such as Extensions, Filters and Plugins for Smarty3 and I believe this is where @noisebleed comes in.
Modules can create 'services' which are globally shared using the ServiceLocator.
The modules can create their own service in their
Now any controller can perform $this->getService('mailerClass') if they wanted to.
The SmartyEngine Module in question should register a 'templating' service key in its initServices method, holding an instance of PPI\Templating\Smarty\SmartyEngine.php
An example of setting up SmartyEngine is here: https://github.com/ppi/framework/blob/2.0/PPI/App.php#L276
<?php defined('SMARTY_DIR') || define('SMARTY_DIR', PPI_VENDOR_PATH . 'Smarty/'); $smartyDriver = new \PPI\Templating\Smarty\Smarty(); $engine = new SmartyEngine( $smartyDriver, new TemplateNameParser(), new FileSystemLoader($templateLocator) );
Hi. Just forked ppi/framework and started to look around.
Is it expected to support several template engines at the same time like in Symfony2? If not, methods like
The module concept is already stabilized? Is there any documentation yet?
offtopic: Do you really want to stick to tabs as stated in Coding Standards? Neither Symfony2, PEAR or ZendFramework allow them. I would suggest 4 spaces instead.
Right now, I don't plan for multiple templating engines at the same time. If you can figure out a nice clean way to do this, then I welcome that idea. It will be useful for the template syntax
The module concept is stablised and really just needs some more love on the "service locator" layer once ZF2 finalise their proposal.
PPI2 will be following the PSR1/PSR2 coding standards that is currently in progress, this will mean 4 spaces instead of 1 tab. Don't worry too much about the coding standards as it will be all cleaned up once PSR1 is finished.
It is possible to support multiple templating engines. It's just a matter of including Symfony
Also, PHP, Twig and Smarty are hardcoded in
Are modules equivalent to Symfony2 bundles? Is there a draft defining the module layout and properties?
Symfony has a nice check_cs script to replace tabs with 4 spaces indentation (and other CS tricks). Give it a try.
I'd really enjoy doing
However I'd like a way to disable the DelegateEngine functionality and revert back to a
If my app was only using PHP views, I would personally not want it to load up TwigEngine or SmartyEngine too for me. So how about, by default it's PHP and you have to enable
<?php $app->multipleTemplateEngines = true; // Try to think of a shorter name.
Yes, pretty much. Right now there's no formal documentation since all of my effort is tied up in developing PPI2 components. If you look at the
Very cool ! The PSR1 standard is coming to a close, I'll definitely be looking to use this. We are also hopefully working on a PSR1_Beautifier to clean up existing code too.
You can make a branch/PR and keep committing to that branch with ammendments until it's finished.
I like your simple idea. This value can also take a string to make it easy for people.
`$app->templatingEngines = 'php'
Looks nice :-)