[TYPO3-templavoila] FCE and availibility of fields (10.file.width.field = field_width)

Matthew Colton mat at colton.de
Tue Nov 4 10:55:36 CET 2008


Hi,
I'm trying to figure something out: How can I access an unmapped value across 
containers. It seems the "field" attribute only has a local scope, i.e. it 
only works within the same container. I' talking about something like:

10.file.width.field = field_width

Take the following DS as an example that doesn't work:

<?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_container type="array">
        <type>array</type>
        <section>1</section>
        <tx_templavoila type="array">
          <title>Picture</title>
          <description>Picture</description>
          <eType>input</eType>
        </tx_templavoila>
        <el type="array">
          <field_img type="array">
            <type>array</type>
            <tx_templavoila type="array">
              <title>Picture</title>
              <description>Picture</description>
              <eType>input</eType>
            </tx_templavoila>
            <el type="array">
              <field_img_img type="array">
                <tx_templavoila type="array">
                  <title>Picture</title>
                  <description>Picture</description>
                  <sample_data type="array">
                    <numIndex index="0"></numIndex>
                  </sample_data>
                  <eType>imagefixed</eType>
                  <TypoScript>
    10 = IMAGE
    10.file.import = uploads/tx_templavoila/
    10.file.import.current = 1
    10.file.import.listNum = 0
    10.file.width.field = field_width
              </TypoScript>
                </tx_templavoila>
                <TCEforms type="array">
                  <config type="array">
                    <type>group</type>
                    <internal_type>file</internal_type>
                    <allowed>gif,png,jpg,jpeg</allowed>
                    <max_size>1000</max_size>
                    <uploadfolder>uploads/tx_templavoila</uploadfolder>
                    <show_thumbs>1</show_thumbs>
                    <size>1</size>
                    <maxitems>1</maxitems>
                    <minitems>0</minitems>
                  </config>
                  <label>Picture</label>
                </TCEforms>
              </field_img_img>
            </el>
          </field_img>
        </el>
      </field_container>
      <field_width type="array">
        <tx_templavoila type="array">
          <title>Picture width</title>
          <description>Picture width</description>
          <sample_data type="array">
            <numIndex index="0"></numIndex>
          </sample_data>
          <eType>select</eType>
        </tx_templavoila>
        <TCEforms type="array">
          <config type="array">
            <type>select</type>
            <items type="array">
              <numIndex index="0" type="array">
                <numIndex index="0">Full width</numIndex>
                <numIndex index="1">630</numIndex>
              </numIndex>
              <numIndex index="1" type="array">
                <numIndex index="0">Half-width</numIndex>
                <numIndex index="1">302</numIndex>
              </numIndex>
            </items>
            <default>0</default>
          </config>
          <label>Picture width</label>
        </TCEforms>
      </field_width>
    </el>
  </ROOT>
</T3DataStructure>


My problem is, that the line "10.file.width.field = field_width" won't work. I 
posted that to Typo3-english, where Dmitry Dulepov politely pointed out that 
I was posting to the wrong group. 
And he also answered: 'If you want to map field to the attribute, you need to 
set field type as "attribute", not "element". Currently in your DS it 
is "element".'
Well first of all, I don't get what he's saying because I think he 
misunderstood my problem, second of all I've done this before and it worked 
and third of all I found out (by trial an error) that my mistake was the fact 
that I tryed to get a field which was not in the same container/scope. The 
following works DS like a charm:

<?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_container type="array">
        <type>array</type>
        <section>1</section>
        <tx_templavoila type="array">
          <title>Picture</title>
          <description>Picture</description>
          <eType>input</eType>
        </tx_templavoila>
        <el type="array">
          <field_img type="array">
            <type>array</type>
            <tx_templavoila type="array">
              <title>Picture</title>
              <description>Picture</description>
              <eType>input</eType>
            </tx_templavoila>
            <el type="array">
              <field_img_img type="array">
                <tx_templavoila type="array">
                  <title>Picture</title>
                  <description>Picture</description>
                  <sample_data type="array">
                    <numIndex index="0"></numIndex>
                  </sample_data>
                  <eType>imagefixed</eType>
                  <TypoScript>
    10 = IMAGE
    10.file.import = uploads/tx_templavoila/
    10.file.import.current = 1
    10.file.import.listNum = 0
    10.file.width.field = field_width
              </TypoScript>
                </tx_templavoila>
                <TCEforms type="array">
                  <config type="array">
                    <type>group</type>
                    <internal_type>file</internal_type>
                    <allowed>gif,png,jpg,jpeg</allowed>
                    <max_size>1000</max_size>
                    <uploadfolder>uploads/tx_templavoila</uploadfolder>
                    <show_thumbs>1</show_thumbs>
                    <size>1</size>
                    <maxitems>1</maxitems>
                    <minitems>0</minitems>
                  </config>
                  <label>Picture</label>
                </TCEforms>
              </field_img_img>
              <field_width type="array">
                <tx_templavoila type="array">
                        <title>Picture width</title>
                  <description>Picture width</description>
                  <sample_data type="array">
                    <numIndex index="0"></numIndex>
                  </sample_data>
                  <eType>select</eType>
                </tx_templavoila>
                <TCEforms type="array">
                  <config type="array">
                    <type>select</type>
                    <items type="array">
                      <numIndex index="0" type="array">
                        <numIndex index="0">Full width</numIndex>
                        <numIndex index="1">630</numIndex>
                      </numIndex>
                      <numIndex index="1" type="array">
                        <numIndex index="0">Half-width</numIndex>
                        <numIndex index="1">302</numIndex>
                      </numIndex>
                    </items>
                    <default>0</default>
                  </config>
                  <label>Picture width</label>
                </TCEforms>
              </field_width>

            </el>
          </field_img>
        </el>
      </field_container>
    </el>
  </ROOT>
</T3DataStructure>

Is there some way to get a field from a global scope as I tried in DS listing 
1? The basic idea is to have a free amount of different image types (normal, 
linked and click-enlarge) and be able to set the scaling for ALL elements at 
once. The examples above are simplified, there is only one image type 
(normal).
Listing 2 works but you have to set the scaling per image which has an 
overhead.

Thanks in advance!

-- 
Ciao
M@


More information about the TYPO3-project-templavoila mailing list