Templates

Templates are basically skeleton documents, code snippets and files to link to. Quanta Plus uses templates fundamentally as a standard file system with enhanced organization and interfacing. You can copy, move or link any repository currently on your system into the templates tree. Think of Quanta Plus templates as having roughly the limitations to your imagination that your file system has.

Templates exist in nested folders. There is no limit to how deep you can nest them however within any given folder Quanta Plus expects a consistent action for the base template type described below. Additionally templates allow for pre and post text to be concatenated to non document type templates. This facilitates tag creation. The next update after the introduction is scheduled to add the ability to pass variables to the text such as image size information to assist in tag creation.

Our goal with templates is to extend them to include multi file “ concept” templates useful for things like placing an order or creating an about section, Ideally this will be a tool for making your work more productive and dynamic. An eventual goal is to have a structural template design mode to deal with site layout and structure which you could use to design and interactively update your sites. If you would like to be involved, check out our help wanted page.

Important

Some of the templates that ship with Quanta Plus have conditions for their usage. Please read carefully the usage statement of conditions at the top of each template before you use it.

Template Types

Currently templates are limited to being one of the following types of objects:

Document
Text to insert in a document
A file to link to form a document

Documents can be any type of document. Generally you would want to nest more specific or diverse documents in subfolders. Here you can make a basic framework for what you do and deliver it to your work in an organized fashion and realize much better efficiency. Text insertion could be anything from a snippet of code to a script or whatever you might wish to use. This overlaps the ability to insert text blocks as an action which can be triggered from the toolbar. Linked files can be binary, PHP class libraries or whatever you like.

Template Scopes

Templates are accessible based upon their established workspace in Quanta Plus

Creating Templates

Create a document structure that you love (XML™, HTML, DocBook, etc..) and click on File->Save as Template->Save as Local/Project Template.

Once this is done, you will notice that (even if it is saved as a Project template) the template does not show in the project tab view. Look into the templates view to find your template under the Project templates tab.

Additionally if you look at your options with the right mouse button you will see complete file management tools for creating folders or copying and pasting templates from one location to another.

Using Templates With Projects

Project templates allow you to be more tightly focused. You can create headers, footers or go dynamic with PHP include files and link them. Additionally there are some very cool things we took into consideration when using templates in projects.

When creating a project you can opt to copy to your local project all the existing global and user templates. Legacy project get default templating abilities so nothing is lost You can choose where to locate your template files so they can be in your server root and easy to upload or you can make them secure to link to below server root which is a very cool trick. When linking to a file not in the project templates you will be prompted to copy the file to the project templates prior to linking. This will prevent broken links on upload. You always have control where you place your templates so you can choose to move them. However Quanta Plus does not track this so you will need to change links.

Managing Template Behavior

Template structure on the template tab is based on the files found in $KDEDIR/share/apps/quanta/templates and $HOME/.kde/share/apps/quanta/templates. Each of these folders is specified as one of three types of container:

files/all

Binaries and such things that get inserted by their URL (i.e. images as an <img src=/src/url>).

text/all

Text that you can insert into the current Quanta Plus document, such as repetitive blocks.

template/all

Document templates which you can create new documents from. These open a new window in Quanta Plus.

To set the behavior of each folder, right mouse button click in the template view on the folder and choose Properties. The following dialog will come up:


Properties dialog.


Type

Drop down box with the three types discussed previously; files, text, template. This box will be grayed out if you have the inherit parent attribute box checked.

Inherit parent attribute (<foo>)

This is checked by default and is fine for all but the top level folders in your templates tree. If the top level folder has this checked, it will basically deactivate templates for that folder and all that aren't explicitly set below it. If this is not a top level folder, then the <blah> will say something like text/all. If it says nothing, then chances are that you are on a top level folder.

Use pre/post text

Enables pre and post text for templates in this folder. This could be a common header/footer for all of your templates for a given project and then you copy content templates into that folder and have a complete page with the custom header/footer as a starting point.

Pre-text

The actual text to insert before your templates content.

Post-text

The actual text to insert after your templates content.