---
title: "Cannot modify header information - headers already sent"
url: "https://www.typo3.net/d/62353-cannot-modify-header-information-headers-already-sent"
source: "typo3.net"
tags: ["Extensions","Entwicklung","Frage"]
created: "2007-05-10"
last_reply: "2007-06-20"
replies: 6
solved: false
page: 1
pages: 1
lang: "de"
---

# Cannot modify header information - headers already sent

Extensions › Entwicklung · 6 Antworten · gestartet 2007-05-10

## Eröffnungsbeitrag

**a3ro** · 2007-05-10 · [Beitrag #1](https://www.typo3.net/d/62353-cannot-modify-header-information-headers-already-sent/1)

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/medicalpodcast.de/httpdocs/typo3conf/ext/medicalpodcast_podcast/pi1/class.tx_medicalpodcastpodcast_pi1.php:280) in /var/www/vhosts/medicalpodcast.de/httpdocs/typo3/sysext/cms/tslib/class.tslib_fe.php on line 2898

warum passiert das bei dem code:

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

class tx_medicalpodcastpodcast_pi1 extends tslib_pibase {
	var $prefixId = 'tx_medicalpodcastpodcast_pi1';		// Same as class name
	var $scriptRelPath = 'pi1/class.tx_medicalpodcastpodcast_pi1.php';	// Path to this script relative to the extension dir.
	var $extKey = 'medicalpodcast_podcast';	// 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_medicalpodcastpodcast_list';
			$this->internal['currentRow'] = $this->pi_getRecord('tx_medicalpodcastpodcast_list',$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,3);;		// The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc.
			$this->internal['searchFieldList']='titel,text';
			$this->internal['orderByList']='uid,titel';

				// Get number of records:
			$res = $this->pi_exec_query('tx_medicalpodcastpodcast_list',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_medicalpodcastpodcast_list');
			$this->internal['currentTable'] = 'tx_medicalpodcastpodcast_list';

				// 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('titel').'</p></td>
					<td valign="top"><p>'.$this->getFieldContent('titel').'</p></td>
				</tr>
				<tr>
					<td nowrap="nowrap" valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('text').'</p></td>
					<td valign="top"><p>'.$this->getFieldContent('text').'</p></td>
				</tr>
				<tr>
					<td nowrap="nowrap" valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('image').'</p></td>
					<td valign="top"><p>'.$this->getFieldContent('image').'</p></td>
				</tr>
				<tr>
					<td nowrap="nowrap" valign="top"'.$this->pi_classParam('singleView-HCell').'><p>'.$this->getFieldHeader('podcast').'</p></td>
					<td valign="top"><p>'.$this->getFieldContent('podcast').'</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
	 *
	 *
	 * Hier wird der inhalt eingebunden und formatiert ^^
	 *
	 *
	 * @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') : '').'>
		<table cellspacing="0" cellpadding="0"><tr>
				<td id="obenlinks" style="background-image:url(fileadmin/medicalpodcast/podcast_01.jpg); width:20px; height:20px;">&nbsp;</td>
				<td id="obenmitte" style="background-image:url(fileadmin/medicalpodcast/podcast_02.jpg); height:20px;">&nbsp;</td>
				<td id="obenrechts" style="background-image:url(fileadmin/medicalpodcast/podcast_03.jpg); width:19px; height:20px; padding:0px;">&nbsp;</td></tr>

				<tr><td id="mittelinks" style="background-image:url(fileadmin/medicalpodcast/podcast_04.jpg); width:20px;">&nbsp;</td>
				<td id="mittemitte" style="background-image:url(fileadmin/medicalpodcast/podcast_05.jpg);">

					<table border = "0" width = "550">
					<tr>
					<td valign="top" rowspan="4" width="110"><p><img width="100" height="100" src="uploads/tx_medicalpodcastpodcast/'.$this->getFieldContent('image').'" /></p></td></tr>
					<tr><td valign="top"><p><b>'.$this->getFieldContent('titel').'</b></p></td></tr>
				<tr><td valign="top"><p>'.nl2br($this->getFieldContent('text')).'</p></td></tr>
				<tr><td valign="top"><p><a href="uploads/tx_medicalpodcastpodcast/'.$this->getFieldContent('podcast').'">Podcast download</a></p></td></tr>
					</table>
				</td>
				<td id="mitterechts" style="background-image:url(fileadmin/medicalpodcast/podcast_06.jpg); width:19px;">&nbsp;</td></tr>

				<tr><td id="untenlinks" style="background-image:url(fileadmin/medicalpodcast/podcast_07.jpg); width:20px; height:20px;">&nbsp;</td>
				<td id="untenmitte" style="background-image:url(fileadmin/medicalpodcast/podcast_08.jpg);height:20px;">&nbsp;</td>
				<td id="untenrechts" style="background-image:url(fileadmin/medicalpodcast/podcast_09.jpg); width:19px; height:20px;">&nbsp;</td>

		</td></tr><table>
			</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></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/gregor_podcast/pi1/class.tx_medicalpodcastpodcast_pi1.php'])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/gregor_podcast/pi1/class.tx_medicalpodcastpodcast_pi1.php']);
}

?>
```

## Antworten

### [#2](https://www.typo3.net/d/62353-cannot-modify-header-information-headers-already-sent/2) · steffenk · 2007-05-11

wenn die Zeilen übereinstimmen, dann hast Du hinter dem ?> Extrazeilen, die Du entfernen musst.

### [#3](https://www.typo3.net/d/62353-cannot-modify-header-information-headers-already-sent/3) · a3ro · 2007-05-13

leider hab ich danach keine extra zeilen.

das problem ist es lief einwandfrei und als die seite umgezogen is kam der fehler aber auf jeder seite auch wo die extension nicht eingebunden ist. beides ist typo3 4.1.1.

### [#4](https://www.typo3.net/d/62353-cannot-modify-header-information-headers-already-sent/4) · jojowob · 2007-06-10

Hallo,
habe den gesamten Sonntag damit verbracht, als Newbie das page-comment einzubinden. Eigentlich hat auch alles geklappt, nur wenn ich eine Seite mit einem erstellten Beitrag aufrufe, kommt genau die gleiche Fehlermeldung wie in diesem Post beschrieben "Header already sent".
Da ich ein ziemlich "jungfräuliches" Typo3 habe, kann ich mir nicht erklären, woher diese Fehlermeldung kommt.
Kann mir jemand auf die Sprünge helfen?

Gruß
jojo

### [#5](https://www.typo3.net/d/62353-cannot-modify-header-information-headers-already-sent/5) · linajoy · 2007-06-19

hast du eventuell die datei im UTF-8 format statt ansi/aski abgespeichert? dann passiert dass auch. oder du hast eine leerzeile oder ein leerzeichen vor dem <?php Grüße Lina

### [#6](https://www.typo3.net/d/62353-cannot-modify-header-information-headers-already-sent/6) · NickD · 2007-06-20

aski = ascii *mit dem finger zeig'  ;)

### [#7](https://www.typo3.net/d/62353-cannot-modify-header-information-headers-already-sent/7) · linajoy · 2007-06-20

:o  Alkohol am Keyboard sollte verboten sein...   :p

---

Quelle: „Cannot modify header information - headers already sent“, typo3.net, https://www.typo3.net/d/62353-cannot-modify-header-information-headers-already-sent
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
