Getting started

Before really building sites using DF/Manager, the Getting started chapter explains some basic which help you understand how things work in DF/Manager.

 

Tools

You can edit html/ctp files in Windows' Notepad, but I recommend getting a decent editor that supports syntax highlighting. Good free tools are Notepad++ and Notepad2.   

 

Directory structure

Some tasks, like creating and maintaining your home page, require you to connect to your web server via FTP. To be able to find your way around on the server, lets first take a look at which directories make DF/Manager work.

During the installation you've uploaded DF/Manager to your public_html or http_docs (depending on your hosting environment) directory. Inside are 2 directories: app and cake. app is the main DF/Manager directory, cake holds the CakePHP framework. Lets look at app:

  • app
    • admin: administration pages
    • config: settings
    • controllers: application logic
    • install: installation scripts
    • locale: translations
    • models: database logic
    • plugins: additional functionality
    • tmp: caching
    • vendors: 3rd party packages
    • views:  your files, the only files save to alter 
    • views-default: default pages,  do not alter 
    • webroot: stylesheets, javascript, images

From now on the app directory will be referred to as the application root or DF/Manager root. As you can see, there's only one directory you should care about: views. Forget about the rest for now.

View templates

View templates are used to control how your site looks; they speak to your users. Most views generate (X)HTML, but they may also be used for XML (RSS-feeds), CSV, etc.

DF/Manager's view templates are build up from 3 layers: layouts, views and elements. Layouts determine the general layout of a page, they wrap around views. Layout files should be placed in /app/views/layouts. DF/Manager's default layout can be overridden by creating a new default layout at /app/views/layouts/default.ctp

DF/Manager's layouts and views are written in PHP and have a file extension of .ctp (CakePHP Template). Views are stored in/app/views and /app/views-default. When editing views, make sure you edit the ones in /app/viewsnot in /app/views-default. The later directory gets overwritten when DF/Manager is updated and your changes are lost.

Make a copy

Each time you update your DF/Manager installation, the /app/views-default directory gets overwritten. For this reason, altered views must be stored in /app/views. By default, the /app/views directory is empty. Copy those files you need to change into this directory so they will overrule the default views.

Note: DF/Manager uses a header  include file (head.php) in its layouts. When copying layout files from /app/views-default/layouts to /app/views/layouts, make sure you also copy head.php.

The views directory of a freshly installed DF/Manager is empty. Creating three sub directories makes editing your site easier:

  • app
    • views
      • landing: landing pages
      • layouts: html layouts
      • pages: pages like home, about, privacy policy, etc.

Example

Here's a typical home page, comprised of a layout, page and some elements:

 

The layout determines the basic structure of the page, the what-goes-where. The layout also loads the header and footer, displayed below:

 

Next comes the page, which is loaded in the content area of the layout. In turn, the page can load one or more elements or have static html items for styling and content:

 

Finally the elements, which are used to actually display product content from the DF/Manager database. Individual elements can be styled and tuned using css stylesheets and through element parameters. The image below show the elements (from left to right and top to bottom)  search_cloud, compilations (featured-items), category_tree and random_product (showing a special offer).