.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt ============================================ Browser Tutorial User Defined Functions (en) ============================================ :Author: Kasper Skårhøj :Created: 2002-11-01T00:32:00 :Changed by: Dirk Wildt :Changed: 2013-12-29T01:43:42 :Classification: browser_tut_userfunc_en :Description: The Browser provides some user defined functions (userFunc). The tutorial is a overwiew with the reference :Keywords: forDevelopers, forIntegrators, browser, userfunc, tutorial, typo3 without php :Author: Dirk Wildt, Die Netzmacher :Email: http://wildt.at.die-netzmacher.de :Website: http://die-netzmacher.de :Language: en |img-1| |img-2| extKey: browser\_tut\_userfunc\_en |img-3| .. _Browser-Tutorial-User-Defined-Functions-en: Browser Tutorial User Defined Functions (en) ============================================ The Browser provides some user defined functions (userFunc). The tutorial is a overwiew with the reference |img-4| Version: 4.8.5, 2013-12-29 - Version is corresponding with the version of the Browser. Extension Key: browser\_tut\_userfunc\_en - Tutorial for the extension Browser (extkey: browser) Language: en Keywords: forDevelopers, forIntegrators, browser, userfunc, tutorial, typo3 without php Copyright 2009-2013, Dirk Wildt, Die Netzmacher, This document is published under the Open Content License available from `http://www.opencontent.org/opl.shtml `_ The content of this document is related to TYPO3 \- a GNU/GPL CMS/Framework available from `www.typo3.org `_ .. _Table-of-Contents: Table of Contents ----------------- `Browser Tutorial User Defined Functions (en) 1 <#__RefHeading__12229_1904948122>`_ `Introduction 3 <#__RefHeading__7097_1965136425>`_ `What does the Tutorial do? 3 <#__RefHeading__12241_1904948122>`_ `What do the Browser userFuncs do? 3 <#__RefHeading__12243_1904948122>`_ `Further Information 3 <#__RefHeading__12245_1904948122>`_ `User defined functions (userFunc) 4 <#__RefHeading__22347_1730107939>`_ `numberformat 4 <#__RefHeading__22349_1730107939>`_ `render\_table 5 <#__RefHeading__19070_1965136425>`_ `render\_uploads 6 <#__RefHeading__22357_1730107939>`_ `Reference 8 <#__RefHeading__22365_1730107939>`_ `plugin.tx\_browser\_pi1 8 <#__RefHeading__930_405142471>`_ `tt\_content.uploads.20 8 <#__RefHeading__932_405142471>`_ `tt\_content.uploads.20 – extended 8 <#__RefHeading__934_405142471>`_ `Forum 11 <#__RefHeading__11300_144712033>`_ `To-Do List 12 <#__RefHeading__12315_1904948122>`_ `Change Log 13 <#__RefHeading__12317_1904948122>`_ .. _Introduction: Introduction ------------ .. _What-does-the-Tutorial-do: What does the Tutorial do? ^^^^^^^^^^^^^^^^^^^^^^^^^^ This is a tutorial for the extension Browser (extkey: browser). It is only a step-by-step introduction for the Browser user defined functions (userFunc) If you are interested in other issues, please note the section "Further Informations" below. .. _What-do-the-Browser-userFuncs-do: What do the Browser userFuncs do? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The Browser uses a lot of TYPO3 API functionality. This has two big benefits: - The Browser developer save a lot of costs, they don't need to program code twice. - You can configure TypoScript by the common way. But sometimes the Browser needs more ore different functionality. The Browser user defined functions extend the Browser with this functionality. The principle is the same: The developer tries to use the origin TYPO3-API code. This saves a lot of work and the configuration of a user defined function is near by the common way. .. _Further-Information: Further Information ^^^^^^^^^^^^^^^^^^^ .. _This-tutorial-in-PDF-format: This tutorial in PDF format """"""""""""""""""""""""""" You find this manual as PDF file at - doc/manual.pdf - `http://typo3-browser.de/typo3conf/ext/browser\_tut\_userfunc\_en/doc/ manual.pdf `_ .. _Browser-Manual-and-Browser-Tutorial-Basics: Browser Manual and Browser Tutorial Basics """""""""""""""""""""""""""""""""""""""""" Manual: The Browser has it's own manual (with the reference of course). - HTML `http://typo3.org/extension-manuals/browser/current/ `_ - PDF `http://typo3-browser.de/typo3conf/ext/browser/doc/manual.pdf `_ Tutorial Basics: A lot of step-by-step introductions. - HTML: `http://typo3.org/extension- manuals/browser\_tut\_basics\_en/current/ `_ - PDF `http://typo3-browser.de/typo3conf/ext/browser\_tut\_basics\_en/do c/manual.pdf `_ .. _User-defined-functions-userFunc: User defined functions (userFunc) --------------------------------- .. _numberformat: numberformat ^^^^^^^^^^^^ .. _Deprecated: Deprecated! """"""""""" The function is deprecated! Since TYPO3 4.5 the TypoScript is extended with a stdWrap property for formatting number formats. If there is any reason, to use the numberformat method of the Browser, you may be use this method like in the snippet below. .. _Profile: Profile """"""" You can configure - the amounts of digits behind the decimal point - the format of the decimal point (i.e. comma or dot) - the format of the thousands seperator (i.e. comma or dot) .. _Example: Example ~~~~~~~ 12345 can become 12,345.00 .. _TypoScript-snippet: TypoScript snippet """""""""""""""""" price = COA price { wrap = \| {$quick\_shop.currencySymbol} 10 = USER 10.userFunc = tx\_browser\_typoscript->numberFormat 10.userFunc { number = TEXT number { value = ###TX\_QUICKSHOP\_PRODUCTS.PRICE### } decimal = 2 dec\_point = {$quick\_shop.dec\_point} thousands\_sep = {$quick\_shop.thousands\_sep} } } .. _render-table: render\_table ^^^^^^^^^^^^^ .. _tt-content-table-20: tt\_content.table.20 """""""""""""""""""" You are using the TypoScript array tt\_content.table.20 for rendering tables usually. This TypoScript contains the userFunc tx\_cssstyledcontent\_pi1->render\_table But this userFunc islimited: for records from tt\_content only .. _Profile: Profile """"""" The render\_tables method of the browser extends the render\_tables method of CSS Styled Content with the capabilities: to handle records of every table It extends the userFunc property in particular. .. _TypoScript-snippet: TypoScript snippet """""""""""""""""" // datasheet 20 < tt\_content.table.20 20 { userFunc = tx\_browser\_cssstyledcontent->render\_table userFunc { // add the value of a field to another field in cObj->data cObjDataFieldWrapper = cObjDataFieldWrapper { cols = tx\_quickshop\_products.cols pi\_flexform = tx\_quickshop\_products.pi\_flexform uid = tx\_quickshop\_products.uid } } field = tx\_quickshop\_products.datasheet stdWrap { // With a prefix comment there won't be any output! prefixComment > } } .. _Example-by-Quick-Shop: Example by Quick Shop """"""""""""""""""""" Quick Shop is using a table in the backend for displaying a datasheet in the frontend. See `http://typo3.org/extensions/repository/view/quick\_shop/ `_ .. _Investigate-Quick-Shop: Investigate Quick Shop ~~~~~~~~~~~~~~~~~~~~~~ - See TCA at `http://forge.typo3.org/projects/extension- qshop/repository/entry/trunk/tca.php `_ Look for "datasheet" - See TypoScript at `http://forge.typo3.org/projects/extension- qshop/repository/entry/trunk/static/setup.txt `_ Look for "render\_table" .. _render-uploads: render\_uploads ^^^^^^^^^^^^^^^ .. _tt-content-uploads-20: tt\_content.uploads.20 """""""""""""""""""""" You are using the TypoScript array tt\_content.uploads.20 for rendering uploads usually. This TypoScript contains the userFunc tx\_cssstyledcontent\_pi1->render\_uploads But this userFunc islimited: - for records from tt\_content only - for building filelinks for the current language only. .. _Profile: Profile """"""" The render\_uploads method of the browser extends the render\_uploads method of CSS Styled Content with the capabilities: - to handle records of every table and - to building filelinks for files in all translations. It extends the userFunc property and the linkProc property in particular. You are able to build your own URL. .. _Markers: Markers """"""" The extended method will replace the defined markers in most of the TypoScript code: - ###KEY###You can upload more than one file. Every file has a key. The first one has the key 0, the second 1, the third 2 and so on. The key is the key of the current file. - ###FILENAME###You can upload more than one file. Every file has a name. The name is the name of the current file. - ###SYS\_LANGUAGE.FLAG###The label of the flag of the current language. I.e. de, fr, gb, ...If the label is empty or the label is 'en', this marker will return 'gb'.Values are taken from the table 'sys\_language'. - ###SYS\_LANGUAGE.TITLE###The label of the current language. I.e. English, Deutsch, Italiano.Values are taken from the table 'sys\_language'. - ###TT\_CONTENT.UID###The uid of the current Browser plugin. ###KEY### AND ###TT\_CONTENT.UID### are needed in context with rendering links. .. _TypoScript-snippet: TypoScript snippet """""""""""""""""" 10 < tt\_content.uploads.20 10 { userFunc = tx\_browser\_cssstyledcontent->render\_uploads userFunc { drs = TEXT drs { value = 0 } } filePath > linkProc { tx\_browser\_pi1 = TEXT tx\_browser\_pi1 { typolink { parameter = {$plugin.org.pages.doc} additionalParams = &tx\_browser\_pi1[docUid]=###TX\_ORG\_DOC.UID###\&t x\_browser\_pi1[download]=###FILENAME### useCacheHash = 1 returnLast = url } } } tableField = tx\_org\_doc.documents fields { from\_path = ###TX\_ORG\_DOC.DOCUMENTS\_FROM\_PATH### files = ###TX\_ORG\_DOC.DOCUMENTS### files { override = ###TX\_ORG\_DOC.THUMBNAIL### } layout = 2 } stdWrap { if.isTrue = ###TX\_ORG\_DOC.THUMBNAIL######TX\_ORG\_DOC.DOCUMENTS###\# ##TX\_ORG\_DOC.DOCUMENTS\_FROM\_PATH### } } .. _DRS-Development-Reporting-System: DRS - Development Reporting System """""""""""""""""""""""""""""""""" If there will be any unexpected result, you can enable the DRS - the Development Reporting System and inspect the logs. But because this is a user function, you don't have the full power of the Browser core code. You have to enable the DRS by TypoScript but not by the extension manager. You need the extension devlog. You enable the DRS with a code like below: userFunc.drs.value = 1 See the TypoScript snippet below. .. _TypoScript-snippet: TypoScript snippet ~~~~~~~~~~~~~~~~~~ 10 < tt\_content.uploads.20 10 { userFunc = tx\_browser\_cssstyledcontent->render\_uploads userFunc { drs = TEXT drs { value = 1 } } ... } .. _Tutorial: Tutorial """""""" If you like to know, how to use the Browser download module – based on tt\_content.uploads.20 and the unserFunc render\_uploads, please refer to the tutorial .. _Browser-Tutorial-Download-Module-en: Browser Tutorial Download Module (en) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - HTML `http://typo3.org/extension- manuals/browser\_tut\_downloads\_en/current/ `_ - PDF `http://typo3-browser.de/typo3conf/ext/browser\_tut\_downloads\_en /doc/manual.pdf `_ .. _Reference: Reference --------- .. _plugin-tx-browser-pi1: plugin.tx\_browser\_pi1 ^^^^^^^^^^^^^^^^^^^^^^^ This tutorial provides only the reference for the user defined functions (see below). You find all other stuff in the manual of the Browser: - HTML `http://typo3.org/documentation/document-library/extension- manuals/browser/current/ `_ - PDF: `http://typo3.org/extensions/repository/view/browser/current/info /?tx\_terfe\_pi1%5BdownloadFile%5D=doc%252Fmanual.pdf `_ .. _tt-content-uploads-20: tt\_content.uploads.20 ^^^^^^^^^^^^^^^^^^^^^^ See the common – the non extended – reference for rendering uploads in your TypoScript at tt\_content.uploads.20 Please take the TypoScript Object Browser for inspecting it. .. _tt-content-uploads-20-extended: tt\_content.uploads.20 – extended ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you like to use the render upload method of the Browser, you have to allocate the user function like in the TypoScript snippet below: 10 < tt\_content.uploads.20 10 { userFunc = tx\_browser\_cssstyledcontent->render\_uploads ... } .. ### BEGIN~OF~TABLE ### .. _linkProc-tx-browser-pi1: linkProc.tx\_browser\_pi1 """"""""""""""""""""""""" .. container:: table-row Property linkProc.tx\_browser\_pi1 Data type COA Description The property linkProc is an origin property of tt\_content.uploads.20. The Browser userFunc extends it with the a property and a register. - **tx\_browser\_pi1** is a content object (TEXT, IMAGE, COA, …).You can use it, to build your own URL for linking. If you are using the property tx\_browser\_pi1 it takes precedence over all other link parameters of linkProc. - **ICON\_REL\_PATH\_FROM\_LINCPROC** will allocated with the path to the image source, which was rendered by linkProc while runtime. ICON\_REL\_PATH\_FROM\_LINCPROC is accessible for the property tx\_browser\_pi1 only! **Example:** :: linkProc { tx_browser_pi1 = COA tx_browser_pi1 { // Link with preview or application icon 10 = IMAGE 10 { file { import { data = register : ICON_REL_PATH_FROM_LINCPROC } } imageLinkWrap = 1 imageLinkWrap { enable = 1 typolink { parameter = {$plugin.org.pages.downloads},\ {$plugin.tx_browser_pi1.typeNum.downloadPageObj} additionalParams = &tx_browser_pi1[plugin]=\ ###TT_CONTENT.UID###\ &tx_browser_pi1[file]=\ single.301.tx_org_downloads.\ ###TX_ORG_DOWNLOADS.UID###.\ documents.###KEY### useCacheHash = 1 title = TEXT title { value = Download: '###TX_ORG_DOWNLOADS.TITLE###' lang { de = Herunterladen: '###TX_ORG_DOWNLOADS.TITLE###' en = Download: '###TX_ORG_DOWNLOADS.TITLE###' } } } } } // Link devider 20 = TEXT 20 { value = //**// } // Link with label 30 = TEXT 30 { data = register : filename typolink { parameter = {$plugin.org.pages.downloads},\ {$plugin.tx_browser_pi1.typeNum.downloadPageObj} additionalParams = &tx_browser_pi1[plugin]=\ ###TT_CONTENT.UID###\ &tx_browser_pi1[file]=\ single.301.tx_org_downloads.\ ###TX_ORG_DOWNLOADS.UID###.\ documents.###KEY### useCacheHash = 1 title = TEXT title { value = Download: '###TX_ORG_DOWNLOADS.TITLE###' lang { de = Herunterladen: '###TX_ORG_DOWNLOADS.TITLE###' en = Download: '###TX_ORG_DOWNLOADS.TITLE###' } } } } } .. _tableField: tableField """""""""" .. container:: table-row Property tableField Data type string Description tableField must have the syntax: table, dot and field. Example tx\_org\_doc.documents. The tableField ist the table and the field, where you are storing your files. **Example:** :: tableField = tx_org_doc.documents .. _fields: fields """""" .. container:: table-row Property fields Data type array Description fields is an array with the elements: - from\_path - files - layout Every element has the stdWrap property. from\_path: If you like to use a directory as a source. files: The list of the uploaded files layout: the document layout. **Example:** :: fields { from_path = ###TX_ORG_DOC.DOCUMENTS_FROM_PATH### files = ###TX_ORG_DOC.DOCUMENTS### files { override = ###TX_ORG_DOC.THUMBNAIL### } layout = ###TX_ORG_DOC.DOCUMENTSLAYOUT### } .. _userFunc: userFunc """""""" .. container:: table-row Property userFunc Data type array Description ... .. ###### END~OF~TABLE ###### .. _Forum: Forum ----- |img-5| Illustration 1: The TYPO3-Frontend-Engine Browser Forum The Browser has its own forum. We speak English and German. You are welcome to post any question, bug or snippet code at TYPO3-Frontend-Engine Browser: Forum `http://typo3-browser-forum.de/ `_ .. _To-Do-List: To-Do List ---------- Nothing to do. .. _Change-Log: Change Log ---------- 4.8.0 **Feature** \* #53397: CSS styled content: table 3.9.14: **Initial release** Tutorial 13 .. ######CUTTER_MARK_IMAGES###### .. |img-1| image:: img-1.png .. :align: left .. |img-2| image:: img-2.jpeg .. :border: 0 .. :height: 20 .. :id: Grafik2 .. :name: Grafik2 .. :width: 69 .. |img-3| image:: img-3.png .. :align: bottom .. :border: 0 .. :height: 27 .. :id: graphics25 .. :name: graphics25 .. :width: 30 .. |img-4| image:: img-4.png .. :align: bottom .. :border: 0 .. :height: 268 .. :id: graphics5 .. :name: graphics5 .. :width: 302 .. |img-5| image:: img-5.jpeg .. :align: left .. :border: 0 .. :height: 161 .. :id: graphics81 .. :name: graphics81 .. :width: 302