[TYPO3-dev] FE plugin development - using sysfolders

Boros Attila attila at thebat.net
Sun Apr 11 22:00:42 CEST 2010


Hi Jigal,

Sunday, April 11, 2010, 8:32:56 AM, you wrote:

JvH> Boros Attila wrote:
>>>>> +Italy           <- SysFolder
>>>>>  +Tuscany        <- SysFolder (a subfolder of Italy)
>>>>>   +Toscana       <- SysFolder (a subfolder of Tuscany)
>>>>>    -Hotel A      <- Normal page inside the Toscana SysFolder
>>>>>
>> Thanks for your answer. I don't actually need a menu, but 4 html
>> selects: country, region, city, hotel. The region select is populated
>> depending on what country is selected, the city select is populated
>> depending on region, etc.

JvH> So, you need a list of subpages on the next level.

>>        <option value="page_id">Hotel Name</option>

JvH> You could use a CONTENT object in TypoScript:

JvH> 10 = CONTENT
JvH> 10 {
JvH>         table = pages
JvH>         select {
JvH>                 # pidInList not used, because the default
JvH>                 # value is current page
JvH>                 selectFields = uid,title
JvH>         }
JvH>         renderObj = TEXT
JvH>         renderObj {
JvH>                 field = title
JvH>                 dataWrap = <option value="{field:uid}">|</option>
JvH>         }
JvH>         wrap = <select name="hotel">|</select>
JvH> }

JvH> (The example is for the "Tuscana" level to follow your example with the
JvH>   Hotel Name)


Thanks for this, it works nicely. I've gotten it a bit further:

temp.tst = COA

# Country list
temp.tst.1 = CONTENT
temp.tst.1{
  table = pages
  select{
    # Hotels page
    pidInList = {$hotelsel.hotelsRoot}
    selectFields = uid, title
    orderBy = title          
  }

  renderObj = COA
  renderObj{
    10 = TEXT
    10{
      typolink.parameter.data = field:uid
      typolink.additionalParams.insertData = 1
      typolink.additionalParams = &country={field:uid}
      typolink.returnLast = url
      wrap = <option value=" | " selected="selected">
      if{
        value.field = uid
        equals.data = GPvar:country
      }
    }

    11 = TEXT
    11 < .10
    11{
      wrap = <option value=" | ">
      if.negate = 1
    }
    
    20 = TEXT
    20.field = title
    wrap = | </option>
  }
  wrap = <select name="country" onchange="ch_country(this.value)"> | </select>
}

# Region list
temp.tst.2 = CONTENT
temp.tst.2{
  table = pages
  select{
    # id of the selected country
    pidInList = {GPvar:country}
    selectFields = uid, title
    orderBy = title          
  }
  renderObj = TEXT
  renderObj{
    field = title
    dataWrap = <option value="{field:uid}"> | </option>
  }
  wrap = <select name="region"> | </select>
}


The country list is working fine, but the region list isn't. Looks like
I can't use pidInList = {GPvar:country} ? In fact it would be better
to save the value of GPvar:country in a variable if it is defined, if
not then initialize the variable with some default value.
Unfortunately I have no idea how to do this.

Is there another syntax for pidInList? I'm using just one value, not a
list.

Thanks a lot for your help!
Attila





More information about the TYPO3-dev mailing list