Itsplanned.com is just launched! - Task and project management overview made easy. Go and try it for free.
TemplaVoila with default elements
03.07.2009

There it was. A very basic TemplaVoila setup with two content elements. A content and a rightbar. The content is of course for all the regular stuff on the page, and the right bar has some standard highlights.

When both the content and the rightbar is of the type Content Elements, you have to manually insert elements on every single page, that should have output.

Wouldn’t it be nice, if the rightbar could have some default Content Elements outputted automatically, if you haven’t inserted any elements? Yes, it would!

So. To the fun part. Open your TemplaVoila section in the TYPO3 backend and edit the Data Structure (DS) for the template. The textfield Data Structure XML has a lot of XML-data and you should scroll down until you find the section of your element. In my case the element is named field_right and I should then find something like this:

...
        <field_right type="array">
				<tx_templavoila type="array">
					<title></title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>ce</eType>
					<TypoScript><![CDATA[
	10= RECORDS
	10.source.current=1
	10.tables = tt_content
	10.wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->
                    ]]></TypoScript>
...

We are then going to edit the <TypoScript>-section, so it should look like this:

...
        <field_right type="array">
				<tx_templavoila type="array">
					<title></title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>ce</eType>
					<TypoScript><![CDATA[
	10= RECORDS
	10.source.current=1
	10.tables = tt_content
	10.wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->
	20 = COA
	20 {
		10 = RECORDS
		10.tables = tt_content
		10.source = 57
		if {
			value.current = 1
			equals =
		}
	}
                    ]]></TypoScript>
...

This will insert an extra set of data. The COA-element is a container used only for checking if there is any content. Inside the 20 we will insert the content of the tt_content-element with the uid 57, if the current value is nonexisting.

The uid should be changed to the uid of your choice and it is even possible to insert a comma separated list of multiple uids.

The result should now be, that the content of uid 57 will be shown on every page, if the page does not have any elements add to the field_right section in TemplaVoila.

There you go. A TemplaVoila setup with some default output.

*IMPORTANT* when making updates to the TemplaVoila configuration (mappings etc.) the above changes WILL BE overwriting.

Leave a Reply