troubleshooting Question

OOP Question

Avatar of tonelm54
tonelm54 asked on
PHP
6 Comments1 Solution43 ViewsLast Modified:
Im fed up of writing a lot of complex HTML code, so thought about writing it in a nice easy object, but what I want to do is build up a statment via multiple calls. For example:-

$myObject->createDiv("divID")->createTextBox("txt1")->createTextBox("txt2")->createTextBox("txt3");

Ive got my code nicely working with:-
$myObject->createDiv("divID");

But I have no idea how I can create my object to accept multiple createTextBox fields. I know its possible as Ive seen it done in PHPCharts library, just no idea how to implement it myself.

I know my examples look easy, but what I want to do inside 'CreateTextBox' is set height, width, ID, Classes, Data objects etc, hence why it becomes complicated, but want to try and make my life easier, and hence the simple example to start with and then I can build out.

Any ideas?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros