Skip to content

Instantly share code, notes, and snippets.

@alienlebarge
Created November 15, 2012 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alienlebarge/4078419 to your computer and use it in GitHub Desktop.
Save alienlebarge/4078419 to your computer and use it in GitHub Desktop.
TYPO3 TemplaVoilà FCE to show addresses with microformats

FCE address

This TemplaVoilà FCE is used to display adress properly formatted. Microformats are used so that they are recognized by the search engine and other tools.

Bugs & improvements

  • Instead of having 3 mandatory fields (field_org, field_streetaddress and field_locality), only the last one in the ds.xml is required (field_locality).
  • The address element must not be used to represent arbitrary addresses (e.g. postal addresses), unless those addresses are in fact the relevant contact information. (The p element is the appropriate element for marking up postal addresses in general.)
    More info here and here
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
<meta type="array">
<langDisable>1</langDisable>
</meta>
<ROOT type="array">
<tx_templavoila type="array">
<title>ROOT</title>
<description>Select the HTML element on the page which you want to be the overall container element for the template.</description>
</tx_templavoila>
<type>array</type>
<el type="array">
<field_org type="array">
<tx_templavoila type="array">
<title>Nom du service, de l'office ou de l'entité</title>
<description>span.org</description>
<sample_data type="array">
<numIndex index="0">Service</numIndex>
</sample_data>
<eType>input</eType>
<tags>span:outer</tags>
<TypoScript type="NULL"></TypoScript>
<proc type="array">
<int>0</int>
<HSC>1</HSC>
<stdWrap><![CDATA[if.isTrue.current = 1
wrap = <strong class="fn org">|</strong><br />]]></stdWrap>
</proc>
<preview></preview>
</tx_templavoila>
<TCEforms type="array">
<label>Nom du service, de l'office ou de l'entité (obligatoire)</label>
<config type="array">
<type>input</type>
<size>48</size>
<eval>required,trim</eval>
</config>
</TCEforms>
</field_org>
<field_acronym type="array">
<tx_templavoila type="array">
<title>Acronyme</title>
<description>Pas de mapping</description>
<sample_data type="array">
<numIndex index="0"></numIndex>
</sample_data>
<eType>input</eType>
<proc type="array">
<HSC type="integer">1</HSC>
<stdWrap></stdWrap>
</proc>
<preview></preview>
</tx_templavoila>
<TCEforms type="array">
<label>Acronyme du service (ex.: SPEV)</label>
<config type="array">
<type>input</type>
<size>12</size>
<eval>trim</eval>
</config>
</TCEforms>
</field_acronym>
<field_streetaddress type="array">
<tx_templavoila type="array">
<title>Adresse</title>
<description>span.street-address</description>
<sample_data type="array">
<numIndex index="0">Adresse</numIndex>
</sample_data>
<eType>input</eType>
<tags>span:outer</tags>
<TypoScript type="NULL"></TypoScript>
<proc type="array">
<int>0</int>
<HSC>1</HSC>
<stdWrap><![CDATA[if.isTrue.current = 1
wrap = <span class="street-address">|</span><br />]]></stdWrap>
</proc>
<preview></preview>
</tx_templavoila>
<TCEforms type="array">
<label>Adresse (obligatoire, permet de générer le lien Google Map)</label>
<config type="array">
<type>input</type>
<size>48</size>
<eval>required,trim</eval>
</config>
</TCEforms>
</field_streetaddress>
<field_postalcode type="array">
<tx_templavoila type="array">
<title>Numéro postal</title>
<description>span.postal-code</description>
<sample_data type="array">
<numIndex index="0">Numéro postal</numIndex>
</sample_data>
<eType>int</eType>
<tags>span:outer</tags>
<TypoScript></TypoScript>
<proc type="array">
<int>1</int>
<HSC>0</HSC>
<stdWrap><![CDATA[if.isTrue.current = 1
wrap = <span class="postal-code">|</span>]]></stdWrap>
</proc>
<preview></preview>
</tx_templavoila>
<TCEforms type="array">
<label>Numéro postal (obligatoire, permet de générer le lien Google Map)</label>
<config type="array">
<type>input</type>
<size>4</size>
<min>4</min>
<max>4</max>
<eval>int</eval>
<checkbox>0</checkbox>
<range type="array">
<upper>9999</upper>
<lower>1000</lower>
</range>
<default type="integer">1000</default>
</config>
</TCEforms>
</field_postalcode>
<field_locality type="array">
<tx_templavoila type="array">
<title>Localité</title>
<description>span.locality</description>
<sample_data type="array">
<numIndex index="0">Localité</numIndex>
</sample_data>
<eType>input</eType>
<tags>span:outer</tags>
<TypoScript type="NULL"></TypoScript>
<proc type="array">
<int>0</int>
<HSC>1</HSC>
<stdWrap><![CDATA[if.isTrue.current = 1
wrap = <span class="locality">|</span><br />]]></stdWrap>
</proc>
<preview></preview>
</tx_templavoila>
<TCEforms type="array">
<label>Localité (permet de générer le lien Google Map)</label>
<config type="array">
<type>input</type>
<size>48</size>
<eval>required,trim</eval>
</config>
</TCEforms>
</field_locality>
<field_tel type="array">
<tx_templavoila type="array">
<title>Numéro de téléphone</title>
<description>span.tel</description>
<sample_data type="array">
<numIndex index="0">0213334455</numIndex>
</sample_data>
<eType>input</eType>
<tags>span:outer</tags>
<TypoScript><![CDATA[
10 = COA
10 {
if.isTrue.current = 1
wrap = <span class="tel">|</span><br />
10 = TEXT
10.value = <abbr title="T&eacute;l&eacute;phone">Tel</abbr>
10.noTrimWrap = |<span class="type">|</span> : |
20 = COA
20 {
wrap = <span class="value">|</span>
10 = TEXT
10.value = +41
10.noTrimWrap = || |
20 = TEXT
20.field = field_tel
20.substring = 1,2
20.noTrimWrap = || |
30 < .20
30.substring = 3,3
40 < .20
40.substring = 6,2
50 < .20
50.substring = 8,2
50.noTrimWrap = |||
}
}]]></TypoScript>
<proc type="array">
<int>0</int>
<HSC>0</HSC>
<stdWrap></stdWrap>
</proc>
<preview></preview>
</tx_templavoila>
<TCEforms type="array">
<label>Téléphone 1 (ex.:0213334455)</label>
<config type="array">
<type>input</type>
<size>10</size>
<eval>trim</eval>
<max>10</max>
<min>10</min>
</config>
</TCEforms>
</field_tel>
<field_fax type="array">
<tx_templavoila type="array">
<title>Numéro de fax 1</title>
<description>span.fax</description>
<sample_data type="array">
<numIndex index="0">21123456789</numIndex>
</sample_data>
<eType>input</eType>
<tags>span:outer</tags>
<TypoScript><![CDATA[
10 = COA
10 {
if.isTrue.current = 1
wrap = <span class="tel">|</span><br />
10 = TEXT
10.value = <abbr title="T&eacute;l&eacute;fax">Fax</abbr>
10.noTrimWrap = |<span class="type">|</span> : |
20 = COA
20 {
wrap = <span class="value">|</span>
10 = TEXT
10.value = +41
10.noTrimWrap = || |
if.isTrue.current = 1
20 = TEXT
20.field = field_fax
20.substring = 1,2
20.noTrimWrap = || |
30 < .20
30.substring = 3,3
40 < .20
40.substring = 6,2
50 < .20
50.substring = 8,2
50.noTrimWrap = |||
}
}]]></TypoScript>
<proc type="array">
<int>0</int>
<HSC>0</HSC>
<stdWrap></stdWrap>
</proc>
<preview></preview>
</tx_templavoila>
<TCEforms type="array">
<label>Fax 1 (ex.:0213334455)</label>
<config type="array">
<type>input</type>
<size>10</size>
<eval>trim</eval>
<max>10</max>
<min>10</min>
</config>
</TCEforms>
</field_fax>
<field_email type="array">
<tx_templavoila type="array">
<title>Courriel 1</title>
<description>a.email</description>
<sample_data type="array">
<numIndex index="0"></numIndex>
</sample_data>
<eType>input</eType>
<tags>a:outer</tags>
<proc type="array">
<HSC>0</HSC>
<stdWrap></stdWrap>
<int>0</int>
</proc>
<preview></preview>
<TypoScript><![CDATA[
10 = TEXT
10 {
if.isTrue.current = 1
value = Courriel
wrap = |<br />
typolink {
parameter.field = field_email
ATagParams = class="email"
title = &Eacute;crire un courriel
}
}
]]></TypoScript>
</tx_templavoila>
<TCEforms type="array">
<label>Courriel 1</label>
<config type="array">
<type>input</type>
<size>48</size>
<eval>trim</eval>
</config>
</TCEforms>
</field_email>
<field_linkservice type="array">
<tx_templavoila type="array">
<title>Page du service</title>
<description>span.link</description>
<sample_data type="array">
<numIndex index="0"></numIndex>
</sample_data>
<eType>link</eType>
<tags>a:outer</tags>
<TypoScript><![CDATA[
10 = TEXT
10 {
field = field_linkservice
if.isTrue.current = 1
typolink.parameter.current = 1
typolink.ATagParams = class="url"
typolink.title = Page du service
wrap = |<br />
}]]></TypoScript>
<proc type="array">
<int>0</int>
<HSC>0</HSC>
<stdWrap></stdWrap>
</proc>
<preview></preview>
</tx_templavoila>
<TCEforms type="array">
<label>Page du service (ex.: www.vd.ch/spev)</label>
<config type="array">
<type>input</type>
<size>15</size>
<max>256</max>
<checkbox></checkbox>
<eval>trim</eval>
<wizards type="array">
<_PADDING type="integer">2</_PADDING>
<link type="array">
<type>popup</type>
<title>Link</title>
<icon>link_popup.gif</icon>
<script>browse_links.php?mode=wizard</script>
<JSopenParams>height=300,width=500,status=0,menubar=0,scrollbars=1</JSopenParams>
</link>
</wizards>
</config>
</TCEforms>
</field_linkservice>
<field_linkmap type="array">
<tx_templavoila type="array">
<title>Plan d'accès</title>
<description>span.link2</description>
<sample_data type="array">
<numIndex index="0"></numIndex>
</sample_data>
<eType>link</eType>
<tags>a:outer</tags>
<TypoScript><![CDATA[
10 = TEXT
10 {
value = Plan d'accès
if.isTrue.current = 1
typolink.parameter.current = 1
#typolink.ATagParams = class="url"
wrap = <span class="greenBullet">|</span><br />
}]]></TypoScript>
<proc type="array">
<int>0</int>
<HSC>0</HSC>
<stdWrap></stdWrap>
</proc>
<preview></preview>
</tx_templavoila>
<TCEforms type="array">
<label>Page interne contenant le plan d'accès</label>
<config type="array">
<type>input</type>
<size>15</size>
<max>256</max>
<checkbox></checkbox>
<eval>trim</eval>
<wizards type="array">
<_PADDING type="integer">2</_PADDING>
<link type="array">
<type>popup</type>
<title>Link</title>
<icon>link_popup.gif</icon>
<script>browse_links.php?mode=wizard</script>
<JSopenParams>height=300,width=500,status=0,menubar=0,scrollbars=1</JSopenParams>
</link>
</wizards>
</config>
</TCEforms>
</field_linkmap>
<field_gmap type="array">
<tx_templavoila type="array">
<title>Lien Google Map</title>
<description>a.gmap</description>
<sample_data type="array">
<numIndex index="0"></numIndex>
</sample_data>
<eType>none</eType>
<tags>a:outer</tags>
<TypoScript><![CDATA[
10 = COA
10 {
wrap = <a href="http://maps.google.ch/maps?q=|sur la carte</a>
10 = TEXT
10.field = field_streetaddress
10.noTrimWrap = || |
20 = TEXT
20.field = field_locality
20.noTrimWrap = || |
30 = TEXT
30.value = Suisse
40 = TEXT
40.value = " title="Localiser l'emplacement sur Google Maps">Localiser
40.noTrimWrap = || |
50 = TEXT
50 {
field = field_acronym
if.isTrue.current = 1
wrap.cObject = COA
wrap.cObject {
10 = TEXT
10.field = field_org
10.wrap = <abbr title="|">
}
noTrimWrap = ||</abbr> |
}
}
]]></TypoScript>
<preview></preview>
</tx_templavoila>
</field_gmap>
</el>
</ROOT>
</T3DataStructure>
<div>
<address class="vcard">
<span class="fn org">Service</span>
<span class="adr">
<span class="street-address">Address</span>
<span class="postal-code">ZIP</span> <span class="locality">City</span>
<span class="country-name hide">CH</span>
</span>
<span class="tel tel">
<span class="type">Phone</span><span class="value">0123456789</span>
</span>
<span class="tel fax">
<span class="type">Phone</span><span class="value">0123456789</span>
</span>
<a class="email email" href="mailto:#">Email</a>
<a class="url link" href="#">Link</a>
<a class="url link2" href="#">Link</a>
<a class="url gmap" href="#">Google Map Link</a>
</address>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment