.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt ======================== EXT: Get record via AJAX ======================== :Author: Kasper Skårhøj :Created: 2002-11-01T00:32:00 :Changed by: Sven Burkert :Changed: 2012-03-08T10:43:28.090000000 :Classification: getrecordviaajax :Description: The keywords help with categorizing and tagging of the manuals. You can combine two or more keywords and add additional keywords yourself. Please use at least one keyword from both lists. If your manual is NOT in english, see next tab "language" ---- forEditors (use this for editors / german "Redakteure") forAdmins (use this for Administrators) forDevelopers (use this for Developers) forBeginners (manuals covering TYPO3 basics) forIntermediates (manuals going into more depth) forAdvanced (covering the most advanced TYPO3 topics) see more: http://wiki.typo3.org/doc_template#tags ---- :Keywords: forAdmins, forBeginners :Author: Sven Burkert :Email: bedienung@sbtheke.de :Info 4: :Language: en |img-1| |img-2| EXT: Get record via AJAX - getrecordviaajax .. _EXT-Get-record-via-AJAX: EXT: Get record via AJAX ======================== Extension Key: getrecordviaajax Language: en Keywords: forAdmins, forBeginners Copyright 2000-2012, Sven Burkert, 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 ----------------- `EXT: Get record via AJAX 1 <#1.EXT:%20Get%20record%20via%20AJAX|outline>`_ **`Introduction 3 <#1.1.Introduction|outline>`_** `What does it do? 3 <#1.1.1.What%20does%20it%20do_|outline>`_ **`Configuration 4 <#1.2.Configuration|outline>`_** `TS Constants 4 <#1.2.1.TS%20Constants|outline>`_ `TS Setup 4 <#1.2.2.TS%20Setup|outline>`_ **`Users manual 6 <#1.3.Users%20manual|outline>`_** **`FAQ 7 <#1.4.FAQ|outline>`_** `1) How do I get rid of the Parsetime-comment? 7 <#1.4.1.1)%20How%20do%20I%20get%20rid%20of%20the%20Parsetime- comment_|outline>`_ `2) How to retrieve the data from another attribute? 7 <#1.4.2.2)%20Ho w%20to%20retrieve%20the%20data%20from%20another%20attribute_|outline>` _ **`ChangeLog 8 <#1.5.ChangeLog|outline>`_** .. _Introduction: Introduction ------------ .. _What-does-it-do: What does it do? ^^^^^^^^^^^^^^^^ Simple extension to request records from database with AJAX and display them in frontend, for example for ImageMaps or for images or links e.g. All you have to do is to provide an ID and a source (e.g. tt\_content or tt\_news) in the attribute “data-ajax” (or any other attribute, when configured) of the HTML-tag which triggers the AJAX request. See demo: http://www.sbtheke.de/demo/getrecordviaajax/ .. _Configuration: Configuration ------------- You can add the template “Get content via AJAX” in field “Include static (from extensions)” in your ROOT page for having an example configuration. With this configuration, you can request data from tt\_content and tt\_news. .. _TS-Constants: TS Constants ^^^^^^^^^^^^ plugin.tx\_getrecordviaajax\_pi1 .. ### BEGIN~OF~TABLE ### .. _default-typeNum: default.typeNum """"""""""""""" .. container:: table-row Property default.typeNum Data type integer Description You can define your own integer here for the new page type, so there shouldn't be any conflicts with other extensions Default 111230 .. _default-src: default.src """"""""""" .. container:: table-row Property default.src Data type string Description Source that should be chosen by default. You can choose another source by adding it to the data-ajax attribute. Default tt\_content .. _default-attr: default.attr """""""""""" .. container:: table-row Property default.attr Data type string Description Name of attribute used in AJAX request Default data-ajax .. ###### END~OF~TABLE ###### plugin.tx\_getrecordviaajax .. ### BEGIN~OF~TABLE ### .. _includeJS: includeJS """"""""" .. container:: table-row Property includeJS Data type boolean Description Include JavaScript file, which contains an example for the AJAX request Default 1 .. _includeJSconf: includeJSconf """"""""""""" .. container:: table-row Property includeJSconf Data type boolean Description Automatically configures page type needed for the AJAX request Default 1 .. _Unknown-Property: ((Unknown Property)) """""""""""""""""""" .. container:: table-row Property Data type Description Default .. ###### END~OF~TABLE ###### .. _TS-Setup: TS Setup ^^^^^^^^ plugin.tx\_getrecordviaajax\_pi1 .. ### BEGIN~OF~TABLE ### .. _sources-name: sources.[name] """""""""""""" .. container:: table-row Property sources.[name] Data type cObject Description Define your sources. There are three examples, for pages, tt\_content and tt\_news. You can use whatever you want, not only content type RECORDS, but also HMENU, TEXT, IMAGE, FILE, ... Use the name of the source in your data-ajax attribute. Default .. _Unknown-Property: ((Unknown Property)) """""""""""""""""""" .. container:: table-row Property Data type Description Default .. _Unknown-Property: ((Unknown Property)) """""""""""""""""""" .. container:: table-row Property Data type Description Default .. ###### END~OF~TABLE ###### **Simple example:** plugin.tx\_getrecordviaajax\_pi1 { sources { tt\_content = RECORDS tt\_content { source.data = GPvar:src source.listNum = 0 source.intval = 1 tables = tt\_content } } } In this example you see the configuration of source “tt\_content”. The content element is rendered by TYPO3. If you want only specific informations from this content element, use “conf”: plugin.tx\_getrecordviaajax\_pi1.sources.tt\_content.conf.tt\_content = TEXT plugin.tx\_getrecordviaajax\_pi1.sources.tt\_content.conf.tt\_content. field = header See TypoScript reference for more informations. .. _Users-manual: Users manual ------------ To trigger an AJAX request, you have just to add the required informations into the attribute “data-ajax” in the form data-ajax="[ID of record],[name of source]" Or, in the short way (without the source): data-ajax="[ID of record]" Then the default source, configured in TypoScript, is taken. **Some examples:** Request content-element with ID 697:... Request page with ID 200: Request tt\_news record with ID 95 in an image map: .. _FAQ: FAQ --- .. _1-How-do-I-get-rid-of-the-Parsetime-comment: 1) How do I get rid of the Parsetime-comment? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This comment disappears when you log out from TYPO3 backend. .. _ChangeLog: ChangeLog --------- See file ChangeLog in extension directory. 8 .. ######CUTTER_MARK_IMAGES###### .. |img-1| image:: img-1.png .. :align: left .. |img-2| image:: img-2.png .. :border: 0 .. :height: 21 .. :hspace: 9 .. :id: Grafik2 .. :name: Grafik2 .. :width: 87