The Register® — Biting the hand that feeds IT

Feeds

Agentless Backup is Not a Myth

A database.ini database configuration file gets created in the config directory. Modify the database.ini file for the MySQL database. We shall be using the development mode as follows:

[development]
    phptype = mysql
    database = test
    hostspec = localhost
    username = root
    password = 
  persistent = true

Modify the config/environment.php directory to set the PHP directory, the trax root directory, and the trax environment mode. Define variables PHP_LIB_ROOT, TRAX_ROOT, and TRAX_ENV.

define("PHP_LIB_ROOT",    "C:/PHP/PEAR");
define("TRAX_ROOT",       "C:/Apache/htdocs/catalog");
define("TRAX_ENV",    "development");

The public/.htaccess file specifies configuration directives for the Apache HTTP server. The configuration directives in the .htaccess file apply to the directory in which the .htaccess file is placed and the sub-directories of the directory. Modify the public/.htaccess file. Replace the following line with the subsequent line:

php_value include_path .:C:\Apache\htdocs\catalog/config
php_value include_path .;C:\Apache\htdocs\catalog/config

The include_path directive specifies a list of directories and is used to locate files. Access the Trax application console with the URL http://localhost/catalog/public.

Modify the C:\Apache\conf\httpd.conf file so the directives in the .htaccess file may override earlier access information. Activate the mod_rewrite module by removing the '#' before the following line:

LoadModule rewrite_module modules/mod_rewrite.so

The mod_rewrite module provides a rules-based rewriting engine to rewrite requested URLs. Also set all the AllowOverride directives to All.

AllowOverride All

The AllowOverride directive specifies which directives in the .htaccess may override earlier access information. Modify the DocumentRoot directive and <Directory> setting in httpd.conf to the following:

DocumentRoot "C:/Apache/htdocs/catalog/public"
<Directory "C:/Apache/htdocs/catalog/public">

Reboot time

Restart the Apache server. We shall generate a model class and the scaffolding for the model class, which models a database table, with the scaffold generator. Create a scaffold.bat file in the C:\Apache\htdocs\catalog directory. Copy the following code to the scaffold.bat file:

php ./script/generate.php scaffold  %1 %2

Before creating the scaffolding, build a database table catalogs in the MySQL database with the SQL script catalog.sql. The primary key field should be "id" and of type INT. Create a scaffolding for the "catalogs" table with the following command:

C:\Apache\htdocs\catalog>scaffold catalog catalog

A model class catalog.php gets generated in the models directory.

<?php
class Catalog extends ActiveRecord {      
}
?>

Regcast training : Hyper-V 3.0, VM high availability and disaster recovery

Latest Comments

Wheres the 3rd generation rails?

My problem with these CRUDy things is they are all so naive. After years of writing DB's I practically never access it unless thru procedures that almost never access one table alone.

All you need is a few clever naming trix and a matching form handling library and you can knock a front end up via the DB itself - and move the DB to any provider changing a connection string.

0
0

@annoying - if you'd used MVC you may have stayed coding

What we're finding is that using Zend framework and Smarty based MVC means that the code is kind of folding in on itself and getting easier and easier.

Say we are producing a bespoke solution. I.e. there is no existing web app like SQL-Ledger, RT, Twiki, Moodle etc etc etc which fulfils the requirements.

OK - So we're going to build a web based application - after all - coders have changed from 4GL, VB, Delphi, to web based like a herd of wildebeest thundering over the plain.

Let's get the framework in place - by which I mean the DEV/TEST/LIVE LAMP servers, backups logins for developers, Twiki page etc, etc.

Now we put in place a basic MVC based app.

Once we are up and running the development gets easier and easier - we just concetrate on getting the clients specs correct - and building a DB structure which will be able to hold the data.

Actually implementing the interface (using Smarty) becomes very easy.

It's difficult to fully explain - but it feels as if after all the different ways of implementing PHP based applications and everybody re-inventing the wheels we are finally closing in on a standard.

0
0
Anonymous Coward

Code Igniter

I also like Code Igniter.

I'd rather have these examples on a UNIX platform though: there's something so retarded about c:\php as an installation directory.

0
0

More from The Register

SCO vs. IBM battle resumes over ownership of Unix
Zombie lawsuit back and wants to suck the brains out of Linux
Bjarne Again: Hallelujah for C++
Plus: Now officially OK to admit you never used STL algorithms
Interwebs taunt Sir Jony over Apple eye candy makeover
Hey Ive, Ive... add more unicorns, willya?
Apple: iOS7 dayglo Barbie makeover is UNFINISHED - report
Plus: You don't like the icons? Blame marketing
Red Hat to ditch MySQL for MariaDB in RHEL 7
So long, Oracle! Don't let the door hit you on the way out
Shy? Socially inadequate? Fiddling with your phone could help
App 'tells the brutal truth' about social inadequates' chatup lines
Java EE 7 melds HTML5 with enterprise apps
New release arrives with GlassFish, NetBeans support
 breaking news
'Office Facebook' firm Tibbr wants you to PAY for mobe-meetings app
Great idea. Punters won't cough for it though
 breaking news
The only Waze is Google: Ad giant tipped to gobble map app 'for $1.3bn'
Pac-Man-satnav-ish upstart in bidding war with Apple, Facebook
 breaking news
PM Cameron calls for modern, programmable computers! (We think)
IT education musings to G8 chiefs to mystify IT industry