Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source MagazineAOE Media

1.4. Typo Script Conditions

Conditions

To use Wurfl in your own Typo Script Templates, you can use conditions.

[device = wap]

After installing the Wurfl Extension all used [device = wap] conditions are run through a Wurfl WAP detection. So you can use this feature without triggering your Typo Script code.

[userFunc = user_wurfl_getDeviceCapability()]

If you want to make more complex queries to the WURFL XML file use the newly implemented User-Func condition user_wurfl_getDeviceCapability(). For a full list of properties you can query please read the reference at the end of this document. Please note, that till now, its only possible to query properties, which return a boolean.

Example

A VERY simple example, would be to display images depending on the capabilities of a mobile device. Here would be a little Typo Script snippet, to show you, how that could be implemented. Of course – for your real projects, the situation might be much more complex.

   0: page = PAGE
   1: page.typeNum=0
   2: 
   3: # For this example we choose to serve XHTML Mobile Profile devices
   4: page.config.additionalHeaders = Content-type: application/vnd.wap.xhtml+xml
   5: 
   6: #Is the device able to display GIF Files?
   7: 
   8: [userFunc = user_wurfl_getDeviceCapability(gif)]
   9: 
  10: page.10=IMAGE
  11: page.10.file=fileadmin/logo.gif
  12: page.10.file.maxW = 70
  13: 
  14: #
  15: [else]
  16: page.15=TEXT

  17: page.15.value=Typo3<br />Get.Content.Right

Abbildung 1This page viewed with the User Agent 'LG/U8120/v1.0'

Abbildung 2The same page, viewed with a 'Nokia 6210' User Agent: