Why use Article Templates (& parameters)?

Form2Content needs to get the data from the forms into the Joomla article. To accomplish this we use the so called "article templates". For each field you use in the form we add a "placeholder" in the template. These placeholders we call template parameters. When you save your form the placeholders are replaced with the field data thus creating your article content.

Article templates are part of the power and flexibility of Form2Content since it gives you the ability to create the same article layout for each Content Type. Because all the article html, plugin and other logic is in a template your end user just needs to fill out a simple form. At this point we assume you have read how to define a Content Type and how to add fields to your form.

Remember the basic working of Form2Content:

form fields (data) + article template (layout) = Joomla article (html)

Default templates ... just to get started

Form2Content creates default article templates in order for users to immediately experience the working of Form2Content. Whenever a content type is created, F2C automatically generates a default template set (intro and main) and links to it. As a result, when you submit your first article with F2C it will actually generate a Joomla article since there is a template present.

DO NOT EDIT THE DEFAULT TEMPLATES UNLESS YOU HAVE SWITCHED OFF THE CREATE DEFAULT TEMPLATE SETTING IN THE CONFIGURATION!

Please read how to use your own custom article templates

Smarty template engine

We use a so called template engine to render (paste) the data from the forms into the article templates. The template engine allows us to use a simple syntax (template parameters) to assign the places where the field information will be pasted.

An example:
If there is a text area (field type) in the F2C submission form called "introduction", users can add plain text into the text area. Now if we want to show the text in our article we need to add the following Template parameter to our introduction template.

{$INTRODUCTION}

The Smarty template engine also allows us to do many other things like only use the first 200 characters of the text. In this case the template parameter would look like this:

{$INTRODUCTION|truncate:200}

Since Smarty is 'smart' it will leave the last word in one piece.

Please follow the Step by Step guide to get started. Via the menu you can find available template parameters for each field. There is also a cheat sheet with an overview.

Smarty documentation

One of the reasons we have chosen Smarty is because of the active support website and documentation. Please follow the following links to the Smarty website for extensive documentation.

Documentation: http://www.smarty.net/docs.php (different languages)
Forum: http://www.smarty.net/forums/

F2C Template location

The Form2Content templates are saved in: < website root > /media/com_form2content/templates

 

F2C Cheat-sheet

An overview of all template parameters (placeholders for your form data). These are used in your F2C intro and main template to parse the data from your submission forms into the Joomla article.

Download

Footer

Form2Content, a Joomla CCK Documentation © 2010 - 2015 Open Source Design | Powered by Form2Content