Feeds

Get your PHP on the right Trax

Framework flattery

High performance access to file storage

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

High performance access to file storage

More from The Register

next story
Windows 8.1, which you probably haven't upgraded to yet, ALREADY OBSOLETE
Pre-Update versions of new Windows version will no longer support patches
Android engineer: We DIDN'T copy Apple OR follow Samsung's orders
Veep testifies for Samsung during Apple patent trial
OpenSSL Heartbleed: Bloody nose for open-source bleeding hearts
Bloke behind the cockup says not enough people are helping crucial crypto project
Microsoft lobs pre-release Windows Phone 8.1 at devs who dare
App makers can load it before anyone else, but if they do they're stuck with it
Half of Twitter's 'active users' are SILENT STALKERS
Nearly 50% have NEVER tweeted a word
Windows XP still has 27 per cent market share on its deathbed
Windows 7 making some gains on XP Death Day
Internet-of-stuff startup dumps NoSQL for ... SQL?
NoSQL taste great at first but lacks proper nutrients, says startup cloud whiz
US taxman blows Win XP deadline, must now spend millions on custom support
Gov't IT likened to 'a Model T with a lot of things on top of it'
prev story

Whitepapers

Mainstay ROI - Does application security pay?
In this whitepaper learn how you and your enterprise might benefit from better software security.
Five 3D headsets to be won!
We were so impressed by the Durovis Dive headset we’ve asked the company to give some away to Reg readers.
3 Big data security analytics techniques
Applying these Big Data security analytics techniques can help you make your business safer by detecting attacks early, before significant damage is done.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Mobile application security study
Download this report to see the alarming realities regarding the sheer number of applications vulnerable to attack, as well as the most common and easily addressable vulnerability errors.