Quick search:


How to specialize a page

There are several ways to specialize a page: create a page subclass or specialize a part of the page. In general, if you can specialize a part of a page, your solution will be easier to reuse. In order to find out if specializing a part of a page will suffice, read how to specialize a part of a page.

What subclasses to create depends on you code maintenance scheme. For simplicity this description assumes the simplest scheme, with only a single subclass.

To create a page subclass you need to know what is the current class of the page. The easiest way to find out is to switch debug mode to 'verbose' and then take look at the page in your browser (how to set the debug mode). In the InformationPart there will be a hint like:
Handlers tried (one of last two succeeded):
example6/EmployeePropertyHoursPage
EmployeePropertyHoursPage
example6/ObjectPropertyPage
ObjectPropertyPage

This means that the framework has tried to include a class EmployeePropertyHoursPage from classFolder 'example6' but did not find one. Then it tried to include a class EmployeePropertyHoursPage in the root classFolder (classes) but neither found that one. Then it tried to include a class ObjectPropertyPage from the classFolder example6. If it did not find one, it included class ObjectPropertyPage from the root classFolder. It is not clear from which folder the class ObjectPropertyPage was included. You have to find out for yourself: if there is a file named 'classObjectPropertyPage.php' in the example6 folder, that one is included, otherwise the one from the root class folder was included. For more information on the class inclusion see the design documentation on request dispatch.

Once you know which class to subclass, you have to select a classFolder to create its file in. If you want the page class to be used by all applications, create it in the root classFolder. If you want the page class to be specific for one application, put it in the application classFolder.

Finally you need to decide what should be the name of the class. If you want it to be used as a default page class for all kinds of peanuts, use the name from those tried that starts with 'Object'. If you want it to be used for peanuts of the specific type, use the other one.

If you want the page class to be even more specific, use another name that starts either with 'Object' or with the type, then specify the part of the name that follows 'Object' or the type as the pntHandler in the url or form that leads to the page. (To change that url or form you will probably have to specialize the page or part that creates the url or form too).

For an example of the specialization of a page class, see example 7.