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

Undefined property using form_widget #22

Closed truckee closed 2 years ago

truckee commented 11 years ago

In v2.1.3, an attempt to create a form using a Smarty template and the symfony form object, the line {form_widget form=$form} results in the following: "Notice: Undefined property: NoiseLabs\Bundle\SmartyBundle\Extension\FormExtension::$resources in G:\Documents\workspace\sym\vendor\noiselabs\smarty-bundle\NoiseLabs\Bundle\SmartyBundle\Extension\FormExtension.php line 325" in "G:\Documents\workspace\sym\src\Mana\AdminBundle/Resources/views/Client/client_addnew.html.tpl"

Without the widget line the template appears as expected.

As an aside: I'm successfully using the default Smarty extension .tpl while in the Netbeans IDE.

vitorbrandao commented 11 years ago

@truckee Thanks for reporting this bug. The form extension is not yet completed. I'll try to look into this issue this weekend.

As an aside: I'm successfully using the default Smarty extension .tpl while in the Netbeans IDE.

Yes, I'm keeping support for both smarty and tpl file extensions but beware that 3rd-party plugins like Assetic won't work with non-smarty file extensions.

truckee commented 11 years ago

Thanks for all your work on this.

I would love to see Smarty validation in Symfony, but I suspect that is a far more daunting task.  I've spent the past couple of days trying without success to validate a form that, with a custom Smarty validator plugin, I could do in less than an hour.  Smarty validation considers request variables rather than entity properties (approximately equal to database table fields).  There appears to be no straightforward method for validating a combination of a mapped and an unmapped field.  Oh well.

George

vitorbrandao commented 11 years ago

@truckee By Smarty validation are you referring to this: http://www.phpinsider.com/php/code/SmartyValidate/?

I would like to deliver a stable/completed version of SmartyBundle with full Symfony forms support. If you are interested in contributing with code please switch to form-extension branch and send PR. We can discuss this feature over here or in IRC freenode.org channels #noiselabs, #smarty or #symfony (just "ping" me).

truckee commented 11 years ago

I wish I was sufficiently competent to contribute!  Tom Lahey of Lahey Fortran once told me there are programmers and there are code writers.  Programmers provide elegant solutions.  Code writers fumble around until they find something that works.  I'm lucky enough to occasionally stumble into the class of code writers.

George

vitorbrandao commented 11 years ago

I guess Jeff Atwood also agrees with Tom Lahey.

Code is not the only way to contribute so I'm always listening for suggestions, advices, bug reports, beta-testing. You're always welcome to contribute in one or all of these ways.

truckee commented 11 years ago

Then sign me up.  Just so you know: I'm a retired alpha-geek who writes small web-hosted database applications for local non-profit organizations as a hobby.  So I've got a lot more time than I have skill.  I'm more than happy to spend time on this - I really like Smarty, Symfony I'm reserving judgment.

George

vitorbrandao commented 11 years ago

Welcome aboard :)

FYI, this bundle is also being used in PPI Framework 2 and it may be used as a standalone library to extend Smarty capabilities (although some more work needs to be done in this field).

Disclaimer: I'm a PPI developer.

PPI is a meta-framework built upon Symfony2 and ZendFramework2 and it's purpose is to pick the best components of each providing a simpler usage for rapid deployment of web applications. It comes integrated with Twitter Bootstrap and jQuery along with other javascript components. If you feel the need to try it drop me a line.

ahilles107 commented 11 years ago

@noisebleed - how about that form extension? any chance for progress?

vitorbrandao commented 11 years ago

@ahilles107 Sadly I'm not using Symfony Forms in my webapps so I lack the motivation and time to finish this extension. But I can mark it as a priority and try to come up with something functional. Are you using Sf2 Forms? If so, can I query you once and awhile for suggestions, testing?

ahilles107 commented 11 years ago

Yes, i'm using Symfony2 Forms - but i'm not a big expert from smarty;) If you will have a question - ask ;)

ahilles107 commented 11 years ago

How i can help with that issue?

vitorbrandao commented 11 years ago

Hello @ahilles107. Thank you very much for your availability. Once I get back to the form branch again I'll let you know. Take care.

ahilles107 commented 11 years ago

Hey again, how about that form extension? Can you check that issue and tell me what's wrong and how i can help?

vitorbrandao commented 11 years ago

Hey, let me check my free time between today and Monday and will get back to you.

ahilles107 commented 11 years ago

I'm still here and waiting.

We have two missing variables in this FormExtension.php file:

$this->resources
$this->templates

when i should start?

vitorbrandao commented 11 years ago

@ahilles107 Do you use IRC? Can you come over to #smarty or #noiselabs and ping me there.

WolleTD commented 11 years ago

I got to this issue, too... I just don't get the slightest idea, what the missing properties are supposed to do... I'll try to figure out... Maybe you could tell me, when you're available in IRC...

vitorbrandao commented 11 years ago

@WolleTD I'm currently working on this, using Twig and PHP implementations from Symfony-2.2 as inspiration. The form rendering is a bit complex and I don't have much free time these days so I'm taking longer than expected. Hope to give it another push this weekend.

The form component has evolved from 2.1 to 2.2 and there already changes on 2.3. Since 2.3 is not yet stable I'm using Forms-2.2 when looking for examples. Next task is to convert the Twig template with form blocks to a Smarty template with functions.

@WolleTD If you see me on #smarty, #symfony or #noiselabs IRC channels just highlight my nick.

ahilles107 commented 11 years ago

any progress with that?

vitorbrandao commented 11 years ago

Hello @ahilles107, I'm currently on vacations, I'll be back on the 23rd. See you then.

Pr9nikVGB commented 5 years ago

Hi guys, somebody found a solution to this problem??

vitorbrandao commented 2 years ago

Forms support has been dropped in the main branch and is currently out of scope for the next release. Closing.