---
title: "zwei kleine Probleme mit meiner Ext:"
url: "https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext"
source: "typo3.net"
tags: ["Extensions","Entwicklung","Frage"]
created: "2006-02-16"
last_reply: "2006-02-19"
replies: 7
solved: true
page: 1
pages: 1
lang: "de"
---

# zwei kleine Probleme mit meiner Ext:

Extensions › Entwicklung · 7 Antworten · gelöst · gestartet 2006-02-16

## Frage

**Unbekannter Benutzer** · 2006-02-16 · [Beitrag #1](https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext/1)

leider hab ich mich schon blind gesucht und nix mehr gefunden -wahrscheinlich in Folge des Blindsuchens  #giggle# :

das eine Problem ist, dass die Extension, für die ich die Beschriftung in Eng und Deu angelegt habe nur in Englisch angezeigt wird...
Eigentlich dürfte das ja durch installieren der static_info_table_de (zusätzlich zur static_info_table) zu erledigens sein, wenn ich das richtig verstanden hab, aber es tut sich nix ?!?
ts_language_de habe ich auch installiert.

Natürlich habe ich auch das Setup modifiziert:

```typoscript
config.sys_language_uid = 0
config.language = de
page = PAGE
page.typeNum = 0
page.bodyTag = <body bgcolor="FFFFFF" leftmargin="0" marginheight="0" marginwidht="0" topmargin="0">
page.stylesheet = fileadmin/frontlader.css
page.10 = TEMPLATE
page.10.template = FILE
page.10.template.file = fileadmin/index.htm
page.10.workOnSubpart = DOKUMENT
page.10 {...
```

-wahrscheinlich hab ich nur irgend ne Kleinigkeit übersehen  :'(

Das Zweite:

die Extension "user_mtb_spotguide" besteht aus drei Datensätzen: user_mtb_spotguide_spots
und zwei relations: user_mtb_spotguide_states und user_mtb_spotguide_kind_of_spot.

Ich bin nach Kaspars Viedeo der CD_collection vorgegangen -hat mir gut geholfen. Allerdings würde ich nun nicht nur nach Orten suchen wollen (die ja im user_mtb_spotguide_spots abgelegt sind -funktioniert einwandtfrei...) sondern auch nach Bundesländern (states) und Art der Location (kind_of_spot) aber dabei kann ich nur nach der Jeweiligen uid suchen -wie ändere ich die class.user_mtbspotguide_pi1.php ab, damit das funktioniert??

nebenbei meine class.user_mtbspotguide_pi1.php:

```php
require_once(PATH_tslib.'class.tslib_pibase.php');

class user_mtbspotguide_pi1 extends tslib_pibase {
	var $prefixId = 'user_mtbspotguide_pi1';		// Same as class name
	var $scriptRelPath = 'pi1/class.user_mtbspotguide_pi1.php';	// Path to this script relative to the extension dir.
	var $extKey = 'user_mtb_spotguide';	// The extension key.
	var $pi_checkCHash = TRUE;
	var $stateCache = array();
	var $kind_of_spotCache = array();
	
	/**
	 * [Put your description here]
	 */
	function main($content,$conf)	{
		switch((string)$conf['CMD'])	{
			case 'singleView':
				list($t) = explode(':',$this->cObj->currentRecord);
				$this->internal['currentTable']=$t;
				$this->internal['currentRow']=$this->cObj->data;
				return $this->pi_wrapInBaseClass($this->singleView($content,$conf));
			break;
			default:
				if (strstr($this->cObj->currentRecord,'tt_content'))	{
					$conf['pidList'] = $this->cObj->data['pages'];
					$conf['recursive'] = $this->cObj->data['recursive'];
				}
				
				return $this->pi_wrapInBaseClass($this->listView($content,$conf));
			break;
		}
	}
	
	/**
	 * [Put your description here]
	 */
	function listView($content,$conf)	{
		$this->conf=$conf;		// Setting the TypoScript passed to this function in $this->conf
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();		// Loading the LOCAL_LANG values
		
		$lConf = $this->conf['listView.'];	// Local settings for the listView function
	
		if ($this->piVars['showUid'])	{	// If a single element should be displayed:
			$this->internal['currentTable'] = 'user_mtbspotguide_spots';
			$this->internal['currentRow'] = $this->pi_getRecord('user_mtbspotguide_spots',$this->piVars['showUid']);
	
			$content = $this->singleView($content,$conf);
			return $content;
		} else {
			$items=array(
				'1'=> $this->pi_getLL('list_mode_1','Mode 1'),
				'2'=> $this->pi_getLL('list_mode_2','Mode 2'),
				'3'=> $this->pi_getLL('list_mode_3','Mode 3'),
			);
			if (!isset($this->piVars['pointer']))	$this->piVars['pointer']=0;
			if (!isset($this->piVars['mode']))	$this->piVars['mode']=1;
	
				// Initializing the query parameters:
			list($this->internal['orderBy'],$this->internal['descFlag']) = explode(':',$this->piVars['sort']);
			$this->internal['results_at_a_time']=t3lib_div::intInRange($lConf['results_at_a_time'],0,1000,5);		// Number of results to show in a listing.
			$this->internal['maxPages']=t3lib_div::intInRange($lConf['maxPages'],0,1000,1000);;		// The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc.
			$this->internal['searchFieldList']='city,state,kind_of_spot';
			$this->internal['orderByList']='city,state,kind_of_spot';
	
				// Get number of records:
			$res = $this->pi_exec_query('user_mtbspotguide_spots',1);
			list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
	
				// Make listing query, pass query to SQL database:
			$res = $this->pi_exec_query('user_mtbspotguide_spots');
			$this->internal['currentTable'] = 'user_mtbspotguide_spots';
	
				// Put the whole list together:
			$fullTable='';	// Clear var;
		#	$fullTable.=t3lib_div::view_array($this->piVars);	// DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line!
	
				// Adds the mode selector.
#			$fullTable.=$this->pi_list_modeSelector($items);
	
				// Adds the search box:
			$fullTable.=$this->pi_list_searchBox();	
			
				// Adds the whole list table
			$fullTable.=$this->pi_list_makelist($res);

				// Adds the result browser:
			$fullTable.=$this->pi_list_browseresults();
	
				// Returns the content from the plugin.
			return $fullTable;
		}
	}
	/**
	 * [Put your description here]
	 */
	function singleView($content,$conf)	{
		$this->conf=$conf;
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();
		
	
			// This sets the title of the page for use in indexed search results:
		if ($this->internal['currentRow']['title'])	$GLOBALS['TSFE']->indexedDocTitle=$this->internal['currentRow']['title'];
	
		$content='<div'.$this->pi_classParam('singleView').'>
			<h1>Details</h1>
			<table>
				<tr>
					<td nowrap="" valign="top" this-="">pi_classParam('singleView-HCell').'><p><strong>'.$this->getFieldHeader('city').'</strong>  </p></td>
					<td valign="top"><p>'.$this->getFieldContent('city').'</p></td>
				</tr>
				<tr>
					<td nowrap="" valign="top" this-="">pi_classParam('singleView-HCell').'><p><strong>'.$this->getFieldHeader('state').'</strong>  </p></td>
					<td valign="top"><p>'.$this->getFieldContent('state').'</p></td>
				</tr>
				<tr>
					<td nowrap="" valign="top" this-="">pi_classParam('singleView-HCell').'><p><strong>'.$this->getFieldHeader('kind_of_spot').'</strong>  </p></td>
					<td valign="top"><p>'.$this->getFieldContent('kind_of_spot').'</p></td>
				</tr>
				<tr>
					<td nowrap="" valign="top" this-="">pi_classParam('singleView-HCell').'><p><strong>'.$this->getFieldHeader('description').'</strong>  </p></td>
					<td valign="top"><p>'.$this->getFieldContent('description').'</p></td>
				</tr>
				<tr>
					<td nowrap="" valign="top" this-="">pi_classParam('singleView-HCell').'><p><strong>'.$this->getFieldHeader('route').'</strong>  </p></td>
					<td valign="top"><p>'.$this->getFieldContent('route').'</p></td>
				</tr>
				<tr>
					<td nowrap="" valign="top" this-="">pi_classParam('singleView-HCell').'><p><strong>'.$this->getFieldHeader('image').'</strong>  </p></td>
					<td valign="top"><p>'.$this->getFieldContent('image').'</p></td>
				</tr>
				<tr>
					<td nowrap="" valign="top" this-="">pi_classParam('singleView-HCell').'><p><strong>'.$this->getFieldHeader('link_to_website').'</strong>  </p></td>
					<td valign="top"><p>'.$this->getFieldContent('link_to_website').'</p></td>
				</tr>
			</table>
		<p>'.$this->pi_list_linkSingle($this->pi_getLL('back','Back'),0).'</p></div>'.
		$this->pi_getEditPanel();
	
		return $content;
	}
	/**
	 * [Put your description here]
	 */
	function pi_list_row($c)	{
		$editPanel = $this->pi_getEditPanel();
		if ($editPanel)	$editPanel='<td>'.$editPanel.'</td>';
	
		return '<tr'.($c%2 this-="">pi_classParam('listrow-odd') : '').'>
				<td valign="top"><p>'.$this->getFieldContent('city').'   </p></td>
				<td valign="top"><p>'.$this->getFieldContent('kind_of_spot').'   </p></td>
				<td valign="top"><p>'.$this->getFieldContent('state').'   </p></td>
			</tr>';
	}
	/**
	 * [Put your description here]
	 */
	function pi_list_header()	{
		return '<tr'.$this->pi_classParam('listrow-header').'>
				<td><p>'.$this->getFieldHeader_sortLink('city').'   </p><p></p></td>
				<td><p>'.$this->getFieldHeader_sortLink('kind_of_spot').'   </p><p></p></td>
				<td><p>'.$this->getFieldHeader_sortLink('state').'   </p><p></p></td>
			</tr>';
	}
	/**
	 * [Put your description here]
	 */
	function getFieldContent($fN)	{
		switch($fN) {
			case 'city':
				return $this->pi_list_linkSingle($this->internal['currentRow'][$fN],$this->internal['currentRow']['uid'],1);	// The "1" means that the display of single items is CACHED! Set to zero to disable caching.
			break;
			case 'state':
				if (!count($this->stateCache)) {
				$query = 'SELECT * FROM user_mtbspotguide_states WHERE pid='.intval($GLOBALS["TSFE"]->id).
						$this->cObj->enableFields('user_mtbspotguide_states');
					$res = mysql(TYPO3_db,$query);
					while($row=mysql_fetch_assoc($res)) {
					$this->stateCache[$row['uid']]=$row;
					}
				}
			return htmlspecialchars($this->stateCache[$this->internal['currentRow']['state']]['state']);
			break;
			case 'kind_of_spot':
				if (!count($this->kind_of_spotCache)) {
				$query = 'SELECT * FROM user_mtbspotguide_kind_of_spot WHERE pid='.intval($GLOBALS["TSFE"]->id).
						$this->cObj->enableFields('user_mtbspotguide_kind_of_spot');
					$res = mysql(TYPO3_db,$query);
					while($row=mysql_fetch_assoc($res)) {
					$this->kind_of_spotCache[$row['uid']]=$row;
					}
				}
			return htmlspecialchars($this->kind_of_spotCache[$this->internal['currentRow']['kind_of_spot']]['kind_of_spot']);
			break;
			default:
				return $this->internal['currentRow'][$fN];
			break;
		}
	}
	/**
	 * [Put your description here]
	 */
	function getFieldHeader($fN)	{
		switch($fN) {
			
			default:
				return $this->pi_getLL('listFieldHeader_'.$fN,'['.$fN.']');
			break;
		}
	}
	
	/**
	 * [Put your description here]
	 */
	function getFieldHeader_sortLink($fN)	{
		return $this->pi_linkTP_keepPIvars($this->getFieldHeader($fN),array('sort'=>$fN.':'.($this->internal['descFlag']?0:1)));
	}
}



if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/user_mtb_spotguide/pi1/class.user_mtbspotguide_pi1.php'])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/user_mtb_spotguide/pi1/class.user_mtbspotguide_pi1.php']);
}

?>
```

Bin euch jetz schon für Hilfe und Geduld dankbar!! *verzweifel*

## Beste Antwort

**woida** · 2006-02-18 · [Beitrag #5](https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext/5)

Ohne dem Tabellenschema kann man dir leider nicht helfen.

## Antworten

### [#2](https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext/2) · Stoneage · 2006-02-17

Lern erstmal richtig php!

### [#3](https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext/3) · Unbekannter Benutzer · 2006-02-17

Danke.

Ich nenn sowas learning by doing.

### [#4](https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext/4) · Unbekannter Benutzer · 2006-02-17

Learnig by doing soll heißen:

So weit war ich bisher, allerdings steckt da der Hund drin:

```php
$content =$this->pi_list_searchBox();
                   $content .= $this->piVars[sword]."";
		           $sword = $this->piVars[sword];
				    if($sword != "") {
           
		           $res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db, 'SELECT * FROM user_mtbspotguide_spots, user_mtbspotguide_states WHERE user_mtbspotguide_states.state = '.$sword.' AND user_mtbspotguide_spots.state = user_mtbspotguide_states.uid');
                   while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
					 $content .= $row['city'].'';
                              }
                    }
 return $this->pi_wrapInBaseClass($content);
```

...

### [#5](https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext/5) · woida · 2006-02-18 · Beste Antwort

(Text siehe oben unter „Beste Antwort“.)

### [#6](https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext/6) · steffenk · 2006-02-19

und ohne genaue Beschreibung ...

Bitte beschreib Dein Problem möglichst genau, damit andere das nachvollziehen können. Aussagen wie "geht nicht, steckt der Wurm drin" reichen einfach nicht.

### [#7](https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext/7) · Unbekannter Benutzer · 2006-02-19

das Sprachproblem ist gelöst: ich dachte, durch das NAlegen verschiedener Sprache, würde auch die locallang ergänzt.. dem war nicht der Fall....

Das zweite (Such-)Problem ist, wie schon gesagt, dass ich nur nach uid`s der "states" und "kind of spot" suchen kann: statt dem Suchwort "Bayern" müsste ich also die Uid von Bayern eingeben (uid = 1), um das gewünschte Ergebnis zu erzielen.

Das Schema:

Die eigentliche Datenbank
user_mtb_spotguide_spots
hat in den Feldern "state" (Bundesland) und "kind_of_spot" (Art) Relations.

Die Relations werden in den Datenbanken "user_mtb_spotguide_states" und "user_mtb_spotguide_kind_of_spot" in den Feldern "state" bzw. "kind_of_spot" beschrieben.

### [#8](https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext/8) · steffenk · 2006-02-19

Dann musst Du eine Join-Abfrage machen.

> select user_mtb_spotguide_spots.*, user_mtb_spotguide_states .state,spotguide_kind_of_spot.spot
> from user_mtb_spotguide_spots
> left join user_mtb_spotguide_states on user_mtb_spotguide_states.uid=user_mtb_spotguide_spots.states
> left join user_mtb_spotguide_kind_of_spot on user_mtb_spotguide_kind_of_spot.uid=user_mtb_spotguide_spots.kind_of_spot
> where ...
> order by ...

---

Quelle: „zwei kleine Probleme mit meiner Ext:“, typo3.net, https://www.typo3.net/d/38041-zwei-kleine-probleme-mit-meiner-ext
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
