a_bertrand Posted March 27, 2011 Posted March 27, 2011 In PHP you are responsible of the look by generating the HTML / CSS / JS and whatever else directly and as well as the reactions from user inputs. For example if I have a login form, you will have somewhere a page which generate all the form for the login, then when the user press the Login button, you receive all that in the same or a new page and check what the user did within the $_POST or $_GET variables. Right? Well that works it's clear. Yet how could it be if instead you define a page by saying this page contains 2 fields and a button, and when the button is pressed you run that function? I'm sure most of you would agree it would be easier to maintain, right? Yet what if you could split completely the HTML and the logic? And what if each "components" (all the fields, buttons and whatever else) remember how they was from one page load to the other? That would be yet better right? Well, this feature is one of the feature which I always like in C# / ASP.NET and yet by doing a bit of research found you could use as well on PHP. http://www.pradosoft.com/ I must admit it's the first time I ever saw this framework, never saw somebody using it. Yet it seems quiet cool, and the examples they give are. For example a button reaction code could be done like that: Template: <com:TContent ID="body"> <h1>TButton Samples</h1> <table class="sampletable"> <tr><td class="samplenote"> Button with customized color, font and width: </td><td class="sampleaction"> <com:TButton Text="text" Width="200px" ForeColor="silver" BackColor="black" Font.Size="14pt" /> </td></tr> <tr><td class="samplenote"> A click button: </td><td class="sampleaction"> <com:TButton Text="click me" OnClick="buttonClicked" /> </td></tr> <tr><td class="samplenote"> A command button: </td><td class="sampleaction"> <com:TButton Text="click me" OnCommand="buttonClicked" CommandName="test" CommandParameter="value" /> </td></tr> <tr><td class="samplenote"> A button causing validation: </td><td class="sampleaction"> <com:TTextBox ID="TextBox" /> <com:TRequiredFieldValidator ControlToValidate="TextBox" Display="Dynamic" ErrorMessage="input required in the textbox" ValidationGroup="Group" /> <com:TButton Text="submit" ValidationGroup="Group" /> </td></tr> </table> Code: <?php class Home extends TPage { public function buttonClicked($sender,$param) { if($param instanceof TCommandEventParameter) $sender->Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}"; else $sender->Text="I'm clicked"; } } ?> Which give this as result: http://www.pradosoft.com/demos/quickstart/?page=Controls.Samples.TButton.Home If I was still actively developing with PHP this would be certainly something I would try. Quote
rulerofzu Posted March 27, 2011 Posted March 27, 2011 Its my understanding that the author of Prado went on to create Yii http://www.yiiframework.com Quote
a_bertrand Posted March 27, 2011 Author Posted March 27, 2011 True but I didn't found this concept in their new library. Maybe I'm wrong but the new one is more MVC (Model View Controller) oriented and less components / events. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.