Design Patterns ?

malu's Avatar, Join Date: Feb 2008
Light Poster
Hi again

I am trying to create a web application that requires use of forms often. I want to use design patterns that I can use easily without hard-coding every time. I think I need to use Factory Pattern. I am new to PHP, so if someone can give me an advise, which design pattern would be more appropriate.

Thanks
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You are absolute correct and Factory is one of the most appropriate one but remember that if you need more type of objects to be created like forms / other things then you can go for abstract factory
0
malu's Avatar, Join Date: Feb 2008
Light Poster
Quote:
Originally Posted by shabbir
You are absolute correct and Factory is one of the most appropriate one but remember that if you need more type of objects to be created like forms / other things then you can go for abstract factory
can you show me a simple example(coding)? lets say i have <input type="text">, how do I implement?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Something like
PHP Code:
CreateObject(string objType)
{
    switch(
objType)
    {
        case 
"text":
            return 
'<input type="text" name="somename" />';
    }