Clickframes.org

Clickframes

Web Application Framework

Configuring your Clickframes-PHP application

Clickframes-PHP is most powerful when you integrate your local development webserver directly with your Clickframes project files. I’ve tried to be thorough for first-time users, but after you’ve done this once, it only takes a few minutes to setup each subsequent project.

Create your project

See Starting a new Clickframes-PHP project for how to create a basic Clickframes-PHP project, then continue below.

Install Apache, PHP, and a database

If you’re here, you probably know how to do this already. For ease, I like to use Wampserver on Windows. If you’re going to use an SQLite database, no installation is necessary.

Enable required PHP libraries

To use SQLite 3 with your Clickframes-PHP project, make sure the required extensions for PDO and SQLite are installed and enabled in php.ini

Point Apache to your project’s webapp directory

There are a few approaches to this, but here’s the quick and dirty way to get Apache to serve files directly from your development directory.

Open up Apache’s httpd.conf and set your document root to the src\main\php\webapp directory of your project.

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "d:/workspace/php-quickstart/src/main/php/webapp"

Further along in httpd.conf, configure the settings for your DocumentRoot defined above. Your preferences may be different from below; these rules are pretty secure.

<Directory "d:/workspace/php-quickstart/src/main/php/webapp">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

Create your database tables

After you’ve run mvn clickframes:gen, the entities in your appspec will be translated into database schemas. Look in \src\main\sql for the SQL scripts that match your database (MySQL or SQLite 3).

If you’re using SQLite, it helps to have a graphical management tool; I’ve been using the free, open-source Sqliteman.

Copy CodeIgniter system files

Download CodeIgniter 1.7.2 and copy the system directory somewhere convenient. I keep mine in d:\CodeIgniter_1.7.2\system.

To use SQLite 3, you must install a newer database driver. Download codeigniter_pdo_sqlite.zip and unzip into the system/database/drivers directory.

Customize index.php

CodeIgniter’s main index.php file lives in your project at src/main/php/webapp/. Change the $system_folder variable to point to the location of your system folder as copied above.

Customize project config files

Your application’s configuration files are found in src/main/php/webapp/application/config. To get started, you only need to change these:

  • config.php
    Customize $config['base_url']
  • database.php
    If you aren’t using SQLite, customize settings for your database.
  • email.php
    Customize $config['smtp_host'] to use an SMTP server somewhere other than localhost.

Go!

Open a browser and visit http://localhost/. If all went well, you’ll be looking at the default page you defined in your appspec.

Try customizing your appspec and regenerating with mvn clickframes:gen — your changes will be immediately visible in your browser.

No Comments

No comments yet.

Leave a comment