Quanta Templates

Quanta Templates

Templates are basically skeleton documents, code snippets and files to link to. Quanta uses templates fundementally 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 templates as having roughly the limitations to your imagination that your file system has.

Templates exist in nested directories. There is no limit to how deep you can nest them however within any given directory Quanta expects a consistent action for the base template type described below. Additionally templates allow for pre and post text to be concatonated 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 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 subdirectories. 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 effiency. 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.

Template scope

Templates are accessible based upon their established workspace in Quanta

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'll notice that (even if it's 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.

Additinoally if you look at your options with the Right Mouse Button (RMB) you will see complete file management tools for creatind directories 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 over all 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 does not track this so you will need to change links. This is a good task for kfilereplace which we are setting up to plug in as a kpart.

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 directories is specified as one of three types of container:

files/all

binaries and such things that get inserted by their url (ie images as an <img src=/src/url>

text/all

text that you can insert into the current quanta document. stuff like repetitive blocks etc

template/all

document templates which you can create new documents from. these open a new window in quanta.

To set the behavior of each directory, righ-click in the template view on the directory and choose proerties. The folowing dialog will come up:



Type

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

Inherit parent attribute (<blah>)

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

Use pre/post text

Enables pre and post text for templates in this directory. This could be a common header/footer for all of your templates for a given project and then you copy content templates into that directory 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.

KDE Logo