All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

Rggooglemap with another table

From TYPO3Wiki
Jump to: navigation, search

notice - Draft

Change the {{draft}} marker to {{review}} when you need a reviewer for text and TypoScript. info


The extension rggooglemap can not only use the default table tt_address but any table you want to. There are several big advantages

  • E.g. you got tt_news records about your latest visits in foreign countries you don't need to create an additonal tt_address record for displaying it
  • You are able to show every field of the table at the POI.

What to do

You need to create a mini extension for every table you want to modify. Use therefore the extension kickstarter

This are the steps to do:

    1. Open kickstarter
    2. Enter an extension key
    3. Click the plus (+) next to Extend existing Tables and choose the table you want to extend
    4. Create 3 new fields: lng (Longitude), lat (Latitude), cat (Category). You can choose different field names, but the shorter the better. The fields just need to be normal input fields (yes the category too). For the geocoding to work your table also needs fields for address (street), city, zip, country. If your table does not have fields for that information, add them as well.
    5. Press Update
    6. Click the plus (+) next to Services: Title & Description is not important but the following fields are: Service type: rggmData, Sub type: enter the table you want to extend (not the extension key, the real table)
    7. Press Update, View Result, then WRITE
    8. Install the extension

Because of a bug of the kickstarter you need to adopt 2 files manually.

If there is yet not file ext_localconf.php just create one in the directory of your new extension (of course with the <?php ?> tags). Open the file ext_tables.php and move the service which looks like

t3lib_extMgm::addService($_EXTKEY,  'rggmData' /* sv type */,  'tx_tst_sv1' /* sv key */,


to the ext_localconf.php file

The bug was resolved with new versions of the kickstarter.

Create the mapping

Now you got an extension which still is not finished because rggooglemap needs to know which field in e.g. tt_news is for the longtitude or latitude. So open the file sv1/class.tx_yourextkey_sv1.php and you are nearly finished.

You need to add those 3 functions and modify them afterwards; make sure to paste them within the existing block that looks like

class tx_yourxtkey_sv1 extends t3lib_svbase {
  // ->> 3 functions have to go here.

note from user: Klick [edit] on this part to view source and copy the correct code.

function getTable($field='') {
  $tbl['lng'] = 'tx_yourtable_lng';
  $tbl['lat'] = 'tx_yourtable_lat';  
  $tbl['rggmcat'] = 'tx_yourtable_cat';
  $tbl['rggmtitle'] = 'name';

  if ($field) return ($tbl[$field]) ? $tbl[$field] : $field;
  else return   $tbl;

function mergeFields($string) {
  $whereFields = $this->getTable();
  $whereOld = array_keys($whereFields);
  $whereNew = array_values($whereFields);
  return str_replace($whereOld, $whereNew, $string);

function addressFields() {
  $address = 'address,city,zip,country';

  return $address;

function getTable

You create the mapping there for your fields. So enter instead of tx_rggooglemap_lng the field name of the field which holds the longtitude. Same for latitude and category.

function addressFields

The string addresses holds the necessary fields for the automatic geocoding. So enter here the fields in the order like street, city, zip, country but of course use the fieldnames from your table!

Register your table in Extension-Manager

Now you have to tell the rggooglemap-Extension, that you added a new table. Go to the Extension-Manager, click on rggooglemap, then you find the configuration of the extension. There is a field "Supportet tables, be careful!", here you have to fill in the name of your table (comma seperated). This step is very important, otherwise it won't work.

You nearly got it

You are really nearly finished! Just one thing: This extensions needs to be installed before rggooglemap! So either deactivate rggooglemap, install this extension and install rggooglemap again or change the order in the localconf.php and delete the cache.

note from a user:
I had to change the sql query in pi1/class.tx_rggooglemap_sv1.php on line 1547: since there is no 'hidden' field in the table 'fe_users' which i wanted to use for my POIs I had to uncomment the clause 'hidden = 0' in the query, otherwhise I would have gotten mysql errors in the frontend.

note from another user:
or just add a column named "hidden" to the fe_users - works fine and you don´t have to touch the class-file

Backend configuration

Coming soon

Frontend configuration


For each additional table you use the template for frontend rendering needs to be adapted. In rggogglemap/template.html you will find the subpart marker <!-- ###TEMPLATE_INFOPOI_1### -->. When you use any table other than tt_news rgogglemap expects this subpart to be in this form <!-- ###TEMPLATE_INFOPOI_[tablename]_1### -->. E.g. for tt_news that would be: <!-- ###TEMPLATE_INFOPOI_TT_NEWS_1### --> You can configure your own template in ts setup: plugin.tx_rggooglemap_pi1.templateFile

Tooltip configuration

rggooglemap uses the field name of your table for the rollover tooltip to your markers. If you want to use a different field you will currently have to change it manually in rggooglemap/pi1/class.tx_rggooglemap_pi1.php on line 1670

Finished extensions

If you finished an extension, please upload it here and not in the TER

lonewsaddress (in TER) adds adress data to tt_news, provides markers for their output and enables Rggooglemap for tt_news.