[TYPO3-german] LanguageMenu mit REALURL - find den BUG nicht :-(

Danny Gräfe danny at graefe-holztreppen.de
Fri Dec 23 06:58:48 CET 2005


Hallo Newsgroup !

Ich habe mich schon durch alle Artikel und Beiträge zu Thema
REAL_URL und LanguageMenu durchgearbeitet und bin mit REAL_URL
auf dem richtigen Weg (siehe http://web416.adebes.de  bzw.
http://web416.adebes.de/en bzw .../fr...) aber ich sitze schon
mehrere Abende und finde den Fehler in der Konfiguration zur
Darstellung des LanguageMenu nicht.

Meine ursprüngliche LanguageMenu ohne REALURL-support wird
eingeblendet damit ist der Marker iO und die Bilder sind im
richtigen verzeichnis - Es wäre wirklich nett wenn Ihr hier
mal über die Konfiguration drüberschaut:

Ich hoffe jemand findet den Fehler den ich da warscheinlich
immer übersehe !


ich danke im Voraus und wünsche allen Typo3´lern der NG
ein Paar besinnliche Tage mit Familie, Freunden und Bekannten.


Danny Gräfe

GRÄFE Treppen
Sachsen





####TEMPLATE SETUP#####

.....

#realurl settings
config.simulateStaticDocuments = 0
config.baseURL = 1
config.tx_realurl_enable = 1

#lanquage and border settings
config.linkVars = L
page.10.marks.SPRACHE = PHP_SCRIPT
page.10.marks.SPRACHE.file = fileadmin/template/languageMenu.php

# German language, sys_language.uid = 0
[globalVar = GP:L = 0]
config.sys_language_uid = 0
config.language = de
config.locale_all = de_DE
[global]
# English language, sys_language.uid = 2
[globalVar = GP:L = 2]
config.sys_language_uid = 2
config.language = en
config.locale_all = english
[global]
# french language, sys_language.uid = 3
[globalVar = GP:L = 3]
config.sys_language_uid = 3
config.language = fr
config.locale_all = french
[global]
# polnish language, sys_language.uid = 4
[globalVar = GP:L = 4]
config.sys_language_uid = 4
config.language = pl
config.locale_all = polnish
page.10.marks.TOP_LOGO = IMAGE
page.10.marks.TOP_LOGO.file = GRLOGO__g*.jpg
[global]
# czech language, sys_language.uid = 5
[globalVar = GP:L = 5]
config.sys_language_uid = 5
config.language = cz
config.locale_all = czech
[global]

####LOCALCONF.PHP####

.......

$TYPO3_CONF_VARS['FE']['addRootLineFields'].= ',tx_realurl_pathsegment';
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
'init' => array(
'enableCHashCache' => 1
),
'preVars' => array(
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'no_cache' => 1,
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '2',
'fr' => '3',
'pl' => '4',
'cz' => '5',
),
'noMatch' => 'bypass',
),
),
'fileName' => array (
'defaultToHTMLsuffixOnPrev' => true,
'index' => array(
'backend.php' => array(
'keyValues' => array (
'type' => 100,
)
),
'print' => array(
'keyValues' => array(
'type' => 98,
)
),
),
),
'postVarSets' => array(
'_DEFAULT' => array (
'article' => array(
array(
'GETvar' => 'tx_ttnews[tt_news]',
),
array(
'GETvar' => 'tx_ttnews[backPid]',
),
),
'category' => array(
array(
'GETvar' => 'tx_ttnews[cat]',
),
),
'neste' => array(
array(
'GETvar' => 'tx_ttnews[pointer]',
),
),
),
),
'pagePath' => array(
'type' => 'user',
'userFunc' =>
'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 3
),
);
?>


####LanguageMenu.php####


<?php
/***************************************************************
*  Copyright notice
*
*  (c) 1999-2004 Kasper Skaarhoj (kasperYYYY at typo3.com)
*  All rights reserved
*
*  This script is part of the TYPO3 project. The TYPO3 project is
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*  A copy is found in the textfile GPL.txt and important notices to the
license
*  from the author is found in LICENSE.txt distributed with these scripts.
*
*
*  This script is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
 * Creates a language-selector menu with three flags, an english, a danish
and
 * a german flag for each language supported on the site.
 *
 * THIS IS AN EXAMPLE designed to work with the official TYPO3 testsite,
 * section "Another site in the ..." You will have to program a similar menu
 * for your own case.
 *
 * $Id: example_languageMenu.php,v 1.5 2004/09/13 22:57:37 typo3 Exp $
 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
 * XHTML compliant
 *
 * @author Kasper Skaarhoj <kasperYYYY at typo3.com>
 */


class user_languageFlag {

  function displayFlag($content,$conf) {

  global $TYPO3_DB, $TSFE;

  // First, select all pages_language_overlay records on the current page.
  // Each represents a possibility for a language.
  $res = $TYPO3_DB->exec_SELECTquery('*',
   'pages_language_overlay',
   'pid='.intval($TSFE->id).
    $TSFE->sys_page->enableFields('pages_language_overlay'),
   'sys_language_uid');

  $langArr = array();
  while($row = $TYPO3_DB->sql_fetch_assoc($res)) {
   $langArr[$row['sys_language_uid']] = $row['title'];
  }

  // Little red arrow, which is inserted to the left of the flag-icon if
  // the TSFE->sys_language_uid equals the language uid
  // (notice that 0=french 1=english is SPECIFIC to this database,
  // because these numbers refer to uid's of the table sys_language)
  $pointer = '<img src="t3lib/gfx/content_client.gif" '.
   'width="7" height="10" align="middle" alt="" />';

  // language definition array
  $languages = array(
                      'de'  => array( 'uid' => 0, 'flag' => 'de'),
   'en' => array( 'uid' => 2, 'flag' => 'en'),
   'fr'  => array( 'uid' => 3, 'flag' => 'fr'),
   'Pl' => array( 'uid' => 4, 'flag' => 'pl'),
   'cz' => array( 'uid' => 5, 'flag' => 'cz'),
   );
  $flag_pic = 'typo3conf/ext/sr_language_menu/flags/';

  // Set each Flag icon. If the language is the current, red arrow is
  // printed to the left. If the language is NOT found (represented by a
  // pages_language_overlay record on this page), the icon is dimmed.
  $flags = array();
  // Create a Template object from t3lib/class.t3lib_tstemplate.php
  $localTempl = new t3lib_TStemplate;

  // Loop over each supported languages
  foreach($languages as $lang => $def) {
   // set the pointer if we are in current language
   $HTML = $TSFE->sys_language_uid==$def['uid']?$pointer:'';

   // flag picture, may be dimmed, if language support doesn't exist for
   // the page.
   $icon = '<img src="'.$flag_pic.
    $def['flag'].($langArr[$def['uid']]||$def['uid']==0?'':'_d').
    '.gif" '. 'width="21" height="13" hspace="5" border="0" alt="'.
    $lang.'" title="'.$lang.'" />';

   // related page link
   // Better links with realURL extension supported by Template object

   // linkData($page,
   //   $oTarget,
   //   $no_cache,
   //   $script,
   //   $overrideArray='',
   //   $addParams='',
   //   $typeOverride='')

   $LD = $localTempl->linkData($GLOBALS['TSFE']->page,
    '', // $oTarget
    '', // $no_cache
    '', // $script
    '', // $overrideArray
    '&L='.$def['uid'], // $addParams, need the & prefix to work
    '0');

   $link = $LD['totalURL'];

   //$link = htmlspecialchars('index.php?id='.$TSFE->id.'&L='.$def['uid']);
   $HTML .= '<a href="'.$link.'" target="_top">'.$icon.'</a>';
   $flags[] = $HTML;
  }

  // Make the little menu. Notice, the menu does ONLY transfer the page-id
  // and the "L" variable (which is also SPECIFIC for this website because
  // "L" has been used in the extension template used to control the
  // language setup)
  return '<table border="0" cellpadding="0" cellspacing="0">'.
   '<tr><td><img src="clear.gif" width="30" height="1" alt="" /></td>'.
   '<td>'.implode('',$flags).'</td></tr></table>';
 }
}
?>







More information about the TYPO3-german mailing list