noiselabs / SmartyBundle

Smarty3 template engine bundle for Symfony
http://smartybundle.readthedocs.io/
GNU Lesser General Public License v3.0
51 stars 36 forks source link

Symfony3 #48

Closed Mikopet closed 8 years ago

Mikopet commented 8 years ago

Hey!

This package isn't allow installing for Symfony 3. But I think it should works. Can you make it installable via composer for symfony3 ? :-)

Thanks!

antonskv commented 8 years ago

@Mikopet It does install, the beta/dev version:

"noiselabs/smarty-bundle": "@dev" Run update after, it should pull it from git.

I'm trying to get it to work now, still trying to solve: Compile Error: ap_DevDebugProjectContainer::getSmartyService(): Failed opening required 'Smarty.class.php'

There is a chunk inside vendor/noiselabs/smarty-bundle/NoiseLabs/Bundle/SmartyBundle/Smarty.php:

`namespace NoiseLabs\Bundle\SmartyBundle;

require_once (defined('SMARTY_DIR')) ? SMARTY_DIR.'Smarty.class.php' : 'Smarty.class.php';`

So since i don't have definition of SMARTY_DIR, it just tries to require it by flat name of the class.

Actual file located at vendor/smarty/smarty/libs/Smarty.class.php, it has no namespace, i guess SMARTY_DIR has to be defined somewhere. I've tried many options inside app/config/config.yml but no luck so far.

Maybe i'm missing something....

Mikopet commented 8 years ago

Ah, it installs fine. I tried only dev-master yesterday, that was the problem :)

I'll test it afternoon, and I'll take feedback :-)

vitorbrandao commented 8 years ago

@antonskv is this still an issue?

davidfuhr commented 8 years ago

SmartyBundle 1.x is not fully compatible with Symfony3. SmartyBundle uses the security.context service which was removed in Symfony3 and there are also deprecations in the assets component.

Supporting Symfony3 requires dropping support for Symfony <2.8 which is a BC break. Therefore i started working on a 2.0-Branch: https://github.com/davidfuhr/SmartyBundle/tree/2.0

antonskv commented 8 years ago

@noisebleed Yeah, i haven't really worked on it since two days ago.

@davidfuhr That's great news. I know Smarty is less in demand that included Twig, but we have like a ton of smarty templates from previous developers which got transferred from pre-symfony legacy site... and of course nobody wants to take a week to crunch through them.

Yeah i think you might be right about the new 2.0, 'cause lowest you can go for supporting previous versions is 2.7+, that's when new asset component was introduced. New Security services (security.token_storage and security.authorization_checker) are backwards compatible, so without new asset component implementation it would've been easy to just update existing bundle.

Thanks for taking the time.

Oh also when i upgraded to 2.8 the bundle didn't work until i added "php" to template engines inside config. The $app global variable was coming up null, so i looked at which service is injected into engine constructor and it's "templating.globals", which seemed to be missing until i added "php" into the engines.

Source of info on templating.globals missing: https://github.com/symfony/symfony/issues/14719

templating.globals is meant to provide global variables to PHP templates.

So probably good to add this into 2.0 branch's README.md in the section of enabling smarty templating engine.

(Don't mean to be a wise-crack, just trying to help)