Feeds

Get your PHP on the right Trax

Framework flattery

Providing a secure and efficient Helpdesk

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

Choosing a cloud hosting partner with confidence

More from The Register

next story
Microsoft on the Threshold of a new name for Windows next week
Rebranded OS reportedly set to be flung open by Redmond
Business is back, baby! Hasta la VISTA, Win 8... Oh, yeah, Windows 9
Forget touchscreen millennials, Microsoft goes for mouse crowd
SMASH the Bash bug! Apple and Red Hat scramble for patch batches
'Applying multiple security updates is extremely difficult'
Apple: SO sorry for the iOS 8.0.1 UPDATE BUNGLE HORROR
Apple kills 'upgrade'. Hey, Microsoft. You sure you want to be like these guys?
ARM gives Internet of Things a piece of its mind – the Cortex-M7
32-bit core packs some DSP for VIP IoT CPU LOL
Lotus Notes inventor Ozzie invents app to talk to people on your phone
Imagine that. Startup floats with voice collab app for Win iPhone
prev story

Whitepapers

A strategic approach to identity relationship management
ForgeRock commissioned Forrester to evaluate companies’ IAM practices and requirements when it comes to customer-facing scenarios versus employee-facing ones.
Storage capacity and performance optimization at Mizuno USA
Mizuno USA turn to Tegile storage technology to solve both their SAN and backup issues.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Beginner's guide to SSL certificates
De-mystify the technology involved and give you the information you need to make the best decision when considering your online security options.
Security for virtualized datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.