DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

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

Extension Key: getrecordviaajax

Language: en

Keywords: forAdmins, forBeginners

Copyright 2000-2012, Sven Burkert, <bedienung@sbtheke.de>

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

EXT: Get record via AJAX 1

`Introduction 3 <#1.1.Introduction|outline>`_

What does it do? 3

`Configuration 4 <#1.2.Configuration|outline>`_

TS Constants 4

TS Setup 4

`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

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

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

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

plugin.tx_getrecordviaajax_pi1

default.typeNum

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

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

Property

default.attr

Data type

string

Description

Name of attribute used in AJAX request

Default

data-ajax

plugin.tx_getrecordviaajax

includeJS

Property

includeJS

Data type

boolean

Description

Include JavaScript file, which contains an example for the AJAX request

Default

1

includeJSconf

Property

includeJSconf

Data type

boolean

Description

Automatically configures page type needed for the AJAX request

Default

1

((Unknown Property))

Property

Data type

Description

Default

TS Setup

plugin.tx_getrecordviaajax_pi1

sources.[name]

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))

Property

Data type

Description

Default

((Unknown Property))

Property

Data type

Description

Default

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

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:<a href="#" data- ajax="697,tt_content">...</a>

Request page with ID 200:<img src="..." data-ajax="200,pages" />

Request tt_news record with ID 95 in an image map:<area target="..." data-ajax="95,tt_news" />

FAQ

1) How do I get rid of the Parsetime-comment?

This comment disappears when you log out from TYPO3 backend.

ChangeLog

See file ChangeLog in extension directory.

8