Template customization

The template set included with the dmBridge distribution is deliberately spartan. It is intended to be a starting point for your own creations, not a finished set of templates itself.

The dmBridge templates can be designed like any other HTML page using the text or WYSIWYG editor of your choice. The only extra consideration is styling the dynamically-generated content produced by the Draw methods. You need to see the HTML code they produce in order to style it. One way to do this is by viewing the source of the generated page in your web browser. A better way is using a DOM inspection tool:

  • The Firebug extension for Firefox
  • The Developer Tools built into IE
  • The Web Inspector built into Safari
  • All of these will enable you to zoom in on a specific element in the page in order to find CSS classes/IDs that your CSS rules can "grab onto."

    The following is a walkthrough of the template customization process.

    1. In dm/objects/templates, make a copy of the basic folder. Give it a descriptive alphanumeric name in all-lowercase (you can use underscores for spaces). We'll call it newtpls.
    2. Register the new template set in the Control Panel, and assign one or more collections to it.
    3. Navigate to your dm/objects folder in your web browser, appending the collection alias you wish to view to the URL like so:

      http://my_server/dm/objects/?r=myalias

      Your collection should come up, displaying results view. Click on a result and object view should load, and so on.

    4. Enter the newtpls/templates folder. Notice subfolders like object, error, favorite, etc. Take a look inside any one of them and notice one or more files with the .html.php extension. These are dmBridge template files. Open one up and notice that it's an HTML file, with some <?php ?> tags in it. Each one of these files corresponds to one of the main views in the dmBridge templates: object view, results view, favorites view, etc. It should be fairly obvious just by looking at them which one is which; check the <title> tag if you're not sure.

    At this point, you know what you need to do, which is to go nuts editing these page templates. If you have inspected any of the template files, you may be wondering about the code within the <?php ?> tags. These are calls to methods in the PHP API, which will be addressed in the coming sections.