![]() |
| | LinkBack | Themen-Optionen | Thema bewerten | Ansicht |
|
#1
| |||
| |||
Hallo Leute, wäre dankbar wenn jemand mir hilfen kann. Ich habe eine Extension geschrieben, die die Daten aus Datenbank ausgeben soll, ich habe defür 2- Seiten angelegt , eine Listview und eine Singleview. klappt alles bis jetzt. Ich habe viele felder angelegt (in Datenbank-tabelle: Name, vorname, Adresse, ........). Probleme: 1- Die Daten wurden in form von Tabelle angezeigt. tauchen aber ein Spalte, wo [id] auch angezeigt (ist automatisch generiert) Spalten sind : [id], Name, Vorname, Adresse ......... Wie kann ich die Spalte [id] nicht in meine Frontend anzeigen lassen. 2- Sind viele felder wie gesagt, meine Frage ist, ob es möglich ist nur einige in Listview anzeigen lassen z.B Name und Vorname und erst wenn man auf die name klickt, wird auf die Singleview verweist wo alle Felder bzw Daten angezeigt werden. Vielen Dank im voraus |
|
#2
| ||||
| ||||
| Hi! Wenn du deine eigene Extension geschrieben hast, um die Listen ansichten auszugeben im Frontend, dann musst du halt in der ändern, daß die eine Spalte nicht angzeigt wird, bzw. nur die datensätze angezeigt werden, die du haben willst... Grüße, Tina |
|
#3
| |||
| |||
| Hallo Tina, Danke für die schnelle Antwort. Kannst du mir bitte noch mehr erklären wie kann ich das machen, ich bin noch neu in Typo3-Welt. Vielen Dank |
|
#4
| ||||
| ||||
| Wenn du wirklich eine eigene Extension geschrieben hast, weißt nur du, wie man das macht ;-) Wenn du eine fertige eingebunden hast, dann brauch ich den Namen, um mehr sagen zu können. |
|
#5
| |||
| |||
| Ich habe eine Eifache Extension geschrieben die Name, vorname, tel, Adresse.. ausgeben soll, mehr nicht. um eine Listview und Singleview zu haben, habe ich ein XML-Datei "flexform_ds" in Extensionverzeichnis gebunden. jetzt weiss ich nicht wo soll ich ändern in Xml-Datei oder class.tx_tkmitarbeiter_pi1.php oder soll einfach ,ich weiss nicht wo, kreuzen ? vielen Dank |
|
#6
| ||||
| ||||
| In deiner pi1-Klasse steht mit Sicherheit drin, daß er die ID mit ausgeben soll. Das musst du halt rausnehmen. Die Flexform-XML-Datei ist nur zuständig für das, was im Backend angezeigt wird. |
|
#7
| |||
| |||
| Ja bestimmt sonst wovon soll es kommen ;-) Ich weiss nicht wo genau soll ich änderen. Steht nicht eine normale SQL-befehle, der die Daten von Datenbank ausgibt. Ich schick dir meine php-datei "class.tx_.....", kannst du mir bitte genau sagen wo und was soll ich änderen. wäre ich sehr dankbar Hier ist php-code ( + die rote plus nur um zu erleichteren wo die wo man änderen soll. denke ich ) <?php /*************************************************************** * Copyright notice * * (c) 2008 * 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 * The GNU General Public License - GNU Project - Free Software Foundation (FSF). * * 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! ***************************************************************/ require_once(PATH_tslib.'class.tslib_pibase.php'); /** * Plugin 'Mitarbeiter-Verzeichnis' for the 'tk_mitarbeiter' extension. * * @package TYPO3 * @subpackage tx_tkmitarbeiter */ class tx_tkmitarbeiter_pi1 extends tslib_pibase { var $prefixId = 'tx_tkmitarbeiter_pi1'; // Same as class name var $scriptRelPath = 'pi1/class.tx_tkmitarbeiter_pi1.php'; // Path to this script relative to the extension dir. var $extKey = 'tk_mitarbeiter'; // The extension key. var $pi_checkCHash = true; /** * Main method of your PlugIn * * @param string $content: The content of the PlugIn * @param array $conf: The PlugIn Configuration * @return The content that should be displayed on the website */ 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; } } /** * Shows a list of database entries * * @param string $content: content of the PlugIn * @param array $conf: PlugIn Configuration * @return HTML list of table entries */ 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'] = 'tx_tkmitarbeiter_personen'; $this->internal['currentRow'] = $this->pi_getRecord('tx_tkmitarbeiter_personen',$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,3); // Number of results to show in a listing. $this->internal['maxPages']=t3lib_div::intInRange($lConf['maxPages'],0,1000,2);; // The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc. $this->internal['searchFieldList']='name,vorname,strassehausnr,plz,telefone'; $this->internal['orderByList']='uid,name,vorname,strassehausnr,plz,telefone'; +// Get number of records: +$res = $this->pi_exec_query('tx_tkmitarbeiter_personen',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('tx_tkmitarbeiter_personen'); +$this->internal['currentTable'] = 'tx_tkmitarbeiter_personen'; // 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 whole list table $fullTable.=$this->pi_list_makelist($res); // Adds the search box: $fullTable.=$this->pi_list_searchBox(); // Adds the result browser: $fullTable.=$this->pi_list_browseresults(); // Returns the content from the plugin. return $fullTable; } } /** * Display a single item from the database * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return HTML of a single database entry */ 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').'> <H2>Record "'.$this->internal['currentRow']['uid'].'" from table "'.$this->internal['currentTable'].'":</H2> <table> <tr> <td nowrap="nowrap" valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('name').'</p></td> <td valign="top"><p>'.$this->getFieldContent('name').'</p></td> </tr> <tr> <td nowrap="nowrap" valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('vorname').'</p></td> <td valign="top"><p>'.$this->getFieldContent('vorname').'</p></td> </tr> <tr> <td nowrap="nowrap" valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('strassehausnr').'</p></td> <td valign="top"><p>'.$this->getFieldContent('strassehausnr').'</p></td> </tr> <tr> <td nowrap="nowrap" valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('plz').'</p></td> <td valign="top"><p>'.$this->getFieldContent('plz').'</p></td> </tr> <tr> <td nowrap="nowrap" valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('telefone').'</p></td> <td valign="top"><p>'.$this->getFieldContent('telefone').'</p></td> </tr> <tr> <td nowrap'.$this->pi_classParam('singleView-HCell').'><p>Last updated:</p></td> <td valign="top"><p>'.date('d-m-Y H:i',$this->internal['currentRow']['tstamp']).'</p></td> </tr> <tr> <td nowrap'.$this->pi_classParam('singleView-HCell').'><p>Created:</p></td> <td valign="top"><p>'.date('d-m-Y H:i',$this->internal['currentRow']['crdate']).'</p></td> </tr> </table> <p>'.$this->pi_list_linkSingle($this->pi_getLL('back','Back'),0).'</p></div>'. $this->pi_getEditPanel(); return $content; } /** * Returns a single table row for list view * * @param integer $c: Counter for odd / even behavior * @return A HTML table row */ 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><p>'.$this->getFieldContent('uid').'</p></td> <td valign="top"><p>'.$this->getFieldContent('name').'</p></td> <td valign="top"><p>'.$this->getFieldContent('vorname').'</p></td> <td valign="top"><p>'.$this->getFieldContent('strassehausnr').'</p></td> <td valign="top"><p>'.$this->getFieldContent('plz').'</p></td> <td valign="top"><p>'.$this->getFieldContent('telefone').'</p></td> </tr>'; } /** * Returns a table row with column names of the table * * @return A HTML table row */ function pi_list_header() { return '<tr'.$this->pi_classParam('listrow-header').'> <td><p>'.$this->getFieldHeader_sortLink('uid').'</p></td> <td><p>'.$this->getFieldHeader_sortLink('name').'</p></td> <td><p>'.$this->getFieldHeader_sortLink('vorname').'</p></td> <td><p>'.$this->getFieldHeader_sortLink('strassehausnr').'</p></td> <td><p>'.$this->getFieldHeader_sortLink('plz').'</p></td> <td><p>'.$this->getFieldHeader_sortLink('telefone').'</p></td> </tr>'; } /** * Returns the content of a given field * * @param string $fN: name of table field * @return Value of the field */ function getFieldContent($fN) { switch($fN) { case 'uid': 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; default: return $this->internal['currentRow'][$fN]; break; } } /** * Returns the label for a fieldname from local language array * * @param [type] $fN: ... * @return [type] ... */ function getFieldHeader($fN) { switch($fN) { default: return $this->pi_getLL('listFieldHeader_'.$fN,'['.$fN.']'); break; } } /** * Returns a sorting link for a column header * * @param string $fN: Fieldname * @return The fieldlabel wrapped in link that contains sorting vars */ 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/tk_mitarbeiter/pi1/class.tx_tkmitarbeiter_pi1.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tk_mitarbeiter/pi1/class.tx_tkmitarbeiter_pi1.php']); } ?> |
|
#8
| ||||
| ||||
| Das ist die Funktion, die dir deine Reihen in der Listenansicht generiert PHP-Code: |
|
#9
| |||
| |||
| Vielen vielen Dank. Das was ich suchte seit Tage |
|
#10
| |||
| |||
| Hallo zusammen. wäre dankbar wenn jemand mir hilfen kann. Ich habe eine Extension geschrieben, die die Daten aus Datenbank ausgeben soll. Wenn die Daten ausgegen werden wird automatisch ein suchfeld angezeigt. meine frage ist: wie kann ich nur diese suchfeld anzeigen lassen und erst wenn ich nach einem Datensatz durch diese suchfeld suche dann werden alle gesuchten Datensätze angezeigt. Ich hoffe dass meine Frage verständlich ist. Vielen Dank im voraus |
![]() |
| Lesezeichen |
| Themen-Optionen | |
| Ansicht | Thema bewerten |
| |
Ähnliche Themen | ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| CSS für eigene Extension | Sareen | Extension modifizieren oder neu erstellen | 5 | 19.04.08 00:54 |
| eigene Extension für Navigation | Nedjem | Extension modifizieren oder neu erstellen | 11 | 02.04.08 13:09 |
| Rechte für eigene Extension | hhbk | TYPO3 4.x Backend | 2 | 13.03.08 14:12 |
| View für eigene Extension | flow | TYPO3 4.x Fragen und Probleme | 0 | 24.10.07 14:19 |
| Eigene Extension / Preisstaffelung | subchannel | Extension modifizieren oder neu erstellen | 0 | 26.08.07 17:50 |