Config mode and general application setup

Directory Structure

Phenotype comes as package with two main folders

  1. _phenotype
  2. htdocs

app1.jpg

The folder _phenotype contains everything wich should be outside the webroot (i.e. the system and your application), htdocs contains everything which must be within the webroot (assets, your static files (CSS, JS, Layout-Images) and the backend). The default URL for the backend is “_phenotype/admin”.

_config.inc.php

_config.inc.php is the main configuration file and of course outside the web root, but also outside the _phenotype main folder on root level. After successfull installation you don’t have to access the _config.inc.php, but you should certainly give it a look to see what constants are available during development.

application folder

Let’s open the application folder:

That folder holds your application. It contains all classes and templates of all components of your application. All files are created automatically within the backend config mode. To relieve you of searching the files, the path is always printed out:

_application.inc.php

There’s one file not referenced in the backend, even though it’s very important. The _application.inc.php file is included on every frontend and backend request. It holds your implementation of the PhenotypeApplication class (global $myApp). Here’s the central place for controlling your application, like configuring application constants, inherit system classes, provide application wide methods and so on.

It’s not availabe for editing in the backend since a syntax error would/will crash your whole system. So you can’t edit it online …

Enabling Configuration Mode

To develop a Phenotype application you must enable configuration mode and give your user superuser rights. Luckily this is automatically done during installation. But you should know how to turn it on and off, at least since we strongly suggest to disable Configuration Mode on live systems …

Right on the beginning of the _config.inc.php file you find three constant definitions:

...
define ("PT_DEBUG",1);
define ("PT_BACKEND",1);
define ("PT_CONFIGMODE",1);
...

To turn of the config mode for any user, just set PT_CONFIGMODE to 0. Furthermore you can turn off the whole backend with PT_BACKEND. You should do that, if you’re not planning to edit anything for a while. So you reduce the risks of hacking and attacks.

If the config mode is available, your user still must have superuser rights to access it. Therefore you must manually set the field usr_su of the table user for all relevant users to 1. So even with Admin rights, you cannot get access to the sanctuary of Phenotype …

Debugging Facilites

When debuggin is turned on, Phenotype gathers a lot of information during a request an presents detailed error messages and system information on failures.

...
define ("PT_DEBUG",1);
...

Since Version 2.7 this information is connected to a backend cookie, so it won’t displayed on computers without backend access, but you should turn it of on a live system anyway. Just to be sure … and to minimze the load.

Phenotype logs errors and information into the folder _phenotype/temp/logs. You can add your own log entries with help of the global object $myLog. See API for more details.

Setting up a new application

If you want to start developing a new application, you can do that with a fresh install or by cleaning up your current instance.

config2.jpg

The cleanup functionalaty is accessible within the config mode. Just press “Select All” and execute the cleanup. After that, you do have a totally empty Phenotype instance.

Now you can start from scratch, but you should at least install the PT_CORE package, to have some basic components, like the Include Page Component.

We recommend to install the structural data from the package PT_DEMO to have some components to be geared to. By doing so, remember to give you all proper rights, since you don’t install any user & rights data.

If you already know the structure of your to be developed website, we strongly suggest to use the Page Wizard Extra, which automatically creates pages, if you enter a space indented sitemap.

Continue with introductive documentation ...

You think Phenotype Wiki/Documentation could be better?
We too. Please contribute: Edit this page

Bookmark and Share