Try <a href="http://api.drupal.org/api/5/function/drupal_set_header" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://api.drupal.org/api/5/function/drupal_set_header</a><br><br><div><span class="gmail_quote">
On 2/1/07, <b class="gmail_sendername">Ernst Plüss</b> <<a href="mailto:ernst.pluess@gmail.com">ernst.pluess@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks for your answers guis!<br><br>What I did so far:<br>1. generated the content of the excel file and store it in a variable<br>2. sent the appropriate http-header information<br>3. sent the excel file with print $exel_contet;
<br><br>First this works fine for the user, he gets the download popup and<br>stores the file. But the next time the user clicks on a drupal link he<br>gets this:<br><br>warning: Cannot modify header information - headers already sent by
<br>(output started at<br>C:\apachefriends\xampp\htdocs\istl\modules\simplenews\simplenews.module:1729)<br>in C:\apachefriends\xampp\htdocs\istl\includes\common.inc on line 269.<br><br>I'm sure to not have any spaces sent before my header information is
<br>sent. But somehow drupal isn't happy that I'm sending header<br>informations myself.<br><br>This is my code:<br> if ($where && $where_tid) {<br> $query = 'SELECT DISTINCT s.mail, <a href="http://s.name">
s.name</a> FROM {sn_subscriptions}<br>s INNER JOIN {sn_snid_tid} t ON s.snid = t.snid WHERE ('.$where.') AND<br>('.$where_tid.')';<br> $result = db_query($query);<br> while ($mail = db_fetch_object($result)) {
<br> $mails[] = $mail;<br> }<br> }<br><br> $data = "Name\tEmail\n";<br> foreach($mails as $entry) {<br> $line = simplenews_clean_value($entry->name);<br> $line .= simplenews_clean_value($entry->mail);
<br> $data .= trim($line)."\n";<br> }<br> $data = str_replace("\r","",$data);<br> header("Content-type: application/x-msdownload");<br> header("Content-Disposition: attachment; filename=news_export.xls");
<br> header("Pragma: no-cache");<br> header("Expires: 0");<br> print "$data";<br><br><br><br>Any ideas?<br>TIA Ernst<br></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>
Johan Forngren <br><br> <a href="mailto:johan@forngren.com">johan@forngren.com</a> :: <a href="http://johan.forngren.com/">http://johan.forngren.com/</a>