Using Project Templates

Project Templates are used to provide a consistent theme to a web application developed with Morfik. A project template defines a number of page templates that can be used to create new pages for generic web sites or for device-specific web sites. Any of these web pages can be assigned as the default page for a specific device and the correct pages will be automatically delivered to the device by the server.

In addition to specifying page layouts, a project theme also includes a style theme that applies default colors, shapes, etc to forms and controls for the project.

Starting a New Project

When a new project is started in the Morfik IDE, if you choose New Web Application you will be presented with a selection of pre-defined project templates: Clockwork Orange, Megapolis, Raspberry Swirl, Rocking Green, and Winter Sunset. There is also an option to start a new project without using any template.

Figure 1 shows the New Web Application dialog box with the pre-defined templates listed on the left side of the dialog box. In the figure the number 1 is next to a list of devices that are supported by specific page templates included in the project template (in this case, Rocking Green). Number 2 indicates an area that will look common to the pages of the web site and number 3 highlights the primary area in the theme for placing new forms and controls.

Figure 1: Template Options When Creating a New Project

A number of pages and forms will be generated once a project theme has been selected and are demonstrated in Figure 2. To see these items, Show Hidden Items must be checked in Project Options on the General tab, otherwise only the two items in the red rectangle will be visible.

When a new page is added to the project, an option to select one of the existing page templates will be available. Initially there is a choice of Blank, Content or Home for generic pages and Blank_iPhone and Content_iPhone for iPhone pages. You can also add you own page templates to the list (see ).

Figure 2: Automatically Created Objects from the Rocking Green Project Template

In addition to creating the page templates, if the Create Sample Pages (next to number 4 in figure 2) is checked, a number of additional pages and forms will be generated that can be incorporated into the web application or just used to get an idea of the types of layouts that are possible. Figure 3 below shows a screenshot of all the pages and forms that are generated when this option is checked. In Figure 4 the Sample Index page automatically created can be viewed. The page layout can be used as it is, including all the subforms and included forms or may be edited to customize it.

Figure 3: Additional Sample Pages And Sample Forms

Figure 4: The Automatically Generated Sample Index Page

Default Pages

Once a page has been created it becomes available as a virtual URL for the web application and is automatically added to the list of available URLs. Figure 4 shows the Default Page dialog that is displayed when clicking the More […] button next to the Default URL combo box on the Application tab of the Project Options. Any of the available URLs can be assigned as the default page for each of the devices listed.

Figure 5: Assigning Default Pages to Different Devices

Related Topics

Back to top