Page 1 of 1
Moving from .NET to PHP
Posted: Sat Oct 23, 2010 11:18 pm
by rhether
Hello All,
I have been programming for a year in .NET using Visual Studio and am now required to learn PHP for work.
I am used to using an IDE such as Visual Studio where I can quickly build forms, and add controls, etc.
In PHP, how does one create their forms, and add controls. Is it all done by hand in an editor ?
I have Netbeans as it handles PHP code writing, but I do not see a method to design forms.
Appreciate any advice.
Thanks, Rick
Re: Moving from .NET to PHP
Posted: Sun Oct 24, 2010 11:38 am
by Jonah Bron
Yes, forms are usually made by hand with a HTML editor. I recommend using Eclipse for PHP, though I really can't compare it to Netbeans as I've never used it.
Re: Moving from .NET to PHP
Posted: Sun Oct 24, 2010 12:23 pm
by josh
.NET is a framework. There are many PHP equivalents. I certainly do not write my forms by hand (except in rare cases)
http://framework.zend.com/manual/en/zend.form.html
It displays my forms, localizes them, validates them, filters the inputs, renders validation messages, escapes my data, etc.. It uses the decorator design pattern so that I can change the markup for 1,000 forms at once, if I wanted.
You can extend and add your own element types. For example maybe you want 'Expiration Date' field to be used in multiple forms, to be composed of two select boxes - you can create & extend your own element types, and re-use them in your forms. Same with creating custom validations, etc..
Forms can also be hierarchically composed, so lets say you built an address form. You could have a 'user profile' form that has 2 address forms ( mailing & street). So you can re-use whole entire forms, elements, etc..
You can even use your forms to validate & filter data coming in from your Web APIs
Re: Moving from .NET to PHP
Posted: Sun Oct 24, 2010 5:52 pm
by Doug G
I think I read somewhere that then new Visual Studio will support PHP.
Re: Moving from .NET to PHP
Posted: Mon Oct 25, 2010 2:42 am
by VladSun
josh wrote:It uses the decorator design pattern so that I can change the markup for 1,000 forms at once, if I wanted.
I thought it was using the Strategy design pattern:
http://framework.zend.com/manual/en/lea ... intro.html
Zend_Form utilizes the decorator pattern in order to render elements and forms. Unlike the classic » decorator pattern, in which you pass an object to a wrapping class, decorators in Zend_Form implement a » strategy pattern, and utilize the metadata contained in an element or form in order to create a representation of it.
Re: Moving from .NET to PHP
Posted: Mon Oct 25, 2010 1:29 pm
by josh
Correct, these decorators are not used by wrapping the Zend_Form class, but rather the Zend_Form class uses 'rendering' strategies that themselves can be decorated. Technically they implement both decorator & strategy patterns.