Feeds

Get your PHP on the right Trax

Framework flattery

The Power of One Brief: Top reasons to choose HP BladeSystem

A controller script catalog_controller.php gets created in the controllers directory. View templates _form.phtml, edit.phtml, index.phtml, add.phtml, and show.phtml get created in the views directory.

Modify the _form.phtml view template. Add the following line as the first line in the _form.phtml form:

<p><label for="catalog_id">Id:</label><br/>
<?= text_field("catalog", "id") ?></p>

The default URL for a URL action is http://localhost/controller/action. Custom URLs may also be defined in the config/routes.php file. For example, the add controller action of catalog controller may be invoked by specifying a custom router in the config/routes.php file. With the custom router the url http://localhost/catalog invokes the add action of the catalog controller.

$router->connect( "catalog",array(":controller" => "catalog",":action" => "add") );

Next, we shall use the scaffolding for the catalogs table to add a new catalog entry. Invoke the index controller action with the URL http://localhost/catalog/index. The catalogs listing gets displayed. The Show, Edit, and Delete links are for displaying, editing and deleting a catalog entry respectively. To create a new listing click on the New hyperlink.

In the New catalog view template, create a new catalog entry and click on Create.

A new catalog entry gets added to the database table catalogs and gets listed in the "Listing catalogs".

There you have it - that's how you create a PHP MVC CRUD application without using too much PHP code thanks to the PHP On Trax Framework. You can download code for the project here

Seven Steps to Software Security

More from The Register

next story
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
Put down that Oracle database patch: It could cost $23,000 per CPU
On-by-default INMEMORY tech a boon for developers ... as long as they can afford it
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Application security programs and practises
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
How modern custom applications can spur business growth
Learn how to create, deploy and manage custom applications without consuming or expanding the need for scarce, expensive IT resources.
Securing Web Applications Made Simple and Scalable
Learn how automated security testing can provide a simple and scalable way to protect your web applications.