Есть ли аналог следующего:
header("Content-type: text/xml");
Я использую Google Maps с Wordpress и получаю сообщение об ошибке "заголовки уже отправлены". Я просмотрел все файлы и удалил все пробелы, но ошибка все еще появляется, поэтому просто интересно, есть ли другой способ выполнить приведенный выше код.
Вот ошибка:
Warning: Cannot modify header information - headers already sent by (output started at /home/medicom/public_html/mapping/wp-content/themes/default/header.php:11) in /home/medicom/public_html/mapping/wp-content/themes/default/new-version1.php on line 45
А это моя страница - http://www.mediwales.com/mapping/test/
onload="load()" onunload="GUnload()">
','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",''',$xmlStr);
$xmlStr=str_replace("&",'&',$xmlStr);
return $xmlStr;
}
// Opens a connection to a MySQL server
$connection=mysql_connect (localhost, $username, $password);
if (!$connection) {
die('Not connected : ' . mysql_error());
}
// Set the active MySQL database
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die ('Can\'t use db : ' . mysql_error());
}
// Select all the rows in the markers table
$query = "SELECT * FROM markers WHERE 1";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
// ADD TO XML DOCUMENT NODE
echo ' ';
}
// End XML file
echo ' ';
?>