[TYPO3-english] templavoila issue

heg george.hategan at gmail.com
Wed Jun 1 12:56:33 CEST 2011


The code you have provided is indeed a working solution (just tried it) which
is greatly appreciated.

The only thing I don't like is the fact that the typoscript actually
generates the structure (div, anchor). 
What if the div class was in a completely different part of the template? 

I'm wondering if there is a more general solution to this kind of problems? 

My initial plan was to map the div class and anchor href separately as
described by the below DS which is not working i.e. setting lib.div_class in
field_anchor_href is useless: 

		<el type="array">
			<field_anchor_href type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Anchor HREF</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>link</eType>
					<TypoScript><![CDATA[10 = TEXT
10.typolink {
  parameter.current = 1
  returnLast = url
}

lib.div_class < 10
lib.div_class.stdWrap.ifEmpty.wrap = none
]]></TypoScript>
					<proc type="array">
						<int>0</int>
						<HSC>1</HSC>
						<stdWrap></stdWrap>
					</proc>
					<preview></preview>
				</tx_templavoila>
				<TCEforms type="array">
					<label>Anchor HREF</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_anchor_href>
			<field_div_class type="array">
				<type>attr</type>
				<tx_templavoila type="array">
					<title>Div Class</title>
					<sample_data type="array">
						<numIndex index="0"></numIndex>
					</sample_data>
					<eType>TypoScriptObject</eType>
					<proc type="array">
						<int>0</int>
						<HSC>0</HSC>
						<stdWrap></stdWrap>
					</proc>
					<preview></preview>
					<TypoScriptObjPath>lib.div_class</TypoScriptObjPath>
				</tx_templavoila>
			</field_div_class>
		</el>

I would than map field_anchor_href to the href attribute of the anchor
and filed_div_class to the class attribute of the div which is more
desirable I believe. 

Can this be achieved?





Chris Müller-3 wrote:
> 
> Hi heg,
> 
> I can think of something like that:
> 
> 10 = COA
> 10 {
>    10 = TEXT
>    10 {
>      wrap = <div id="div_id" class="|">
>      value = link_yes
>      override = link_no
>      override.if.isFalse.current = 1
>    }
> 
>    20 = TEXT
>    20 {
>      typolink.parameter.current  = 1
>      typolink.returnLast = url
>      wrap =  | Link 
>    }
> 
>    30 = TEXT
>    30.value = </div>
> }
> 
> It is untested but perhaps a good start. You just map the link field and 
> wrap the surrounding div via typoscript.
> 
> Regards,
> Chris.
> 
> Am 31.05.2011 12:23, schrieb heg:
>>
>> Hi everybody, I'm struggling with the following scenario:
>>
>> My HTML template below
>>      &lt;div id="div_id" class="...">
>>          &lt;a id="anchor_id" href="...">Link&lt;/a>
>>      &lt;/div>
>>
>> is mapped to a templavoila DS as follows:
>>      - the anchor's href attribute is mapped from a link field and works
>> just
>> fine
>>          10 = TEXT
>>          10.typolink {
>>            parameter.current = 1
>>            returnLast = url
>>          }
>>      - div's class attribute is defined as typoscript object path
>> (lib.div_class) and should be set to a certain value if the link above is
>> not defined.
>>
>> Since the content of the link field cannot be accessed in the page
>> template,
>> I've tried setting the value of div_class in the 'Data processing>
>> Typoscript code' section of the anchor's href, right after the typoscript
>> above but it doesn't work like this.
>>
>> I've wasted already too much time on this and eventually decided to ask
>> for
>> help on how to accomplish the task. Thank you!
> 
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
> 
> 

-- 
View this message in context: http://old.nabble.com/templavoila-issue-tp31739607p31748473.html
Sent from the TYPO3 English mailing list archive at Nabble.com.



More information about the TYPO3-english mailing list