<area> <value>'.$row['squarefeet'].'</value> <unit>'.($row['squarefeet']!='' ? 'кв.м' : '').'</unit> </area>
getNode($row['squarefeet']);
Вот именно при вставке
dma84, нужно чтоб вообще пустых тегов не было. т.е. чтоб и <area> с <value> не выводились.
Вот код:
<?php mysql_connect("localhost", "********", "*****"); //db_login - имя и пароль пользователя в mysql mysql_select_db("*******") or die ("Unable to select database"); // имя БД $q=mysql_query("SET CHARACTER SET UTF8"); $myItemid = 34; $er_imagedirectory = 'ezrealty'; # Don't allow direct linking // defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); // global $database, $mainframe, $my, $Itemid, $mosConfig_absolute_path, $mosConfig_MetaDesc; //$er_rssname = stripslashes($er_rssname); // set the file content type and character set header("Content-Type: text/xml;charset=UTF-8"); $mydate = date("Y-m-d\TH:i:s+03:00"); //$phpversion = phpversion(); //set the beginning of the xml file ECHO <<<END <?xml version="1.0" encoding="UTF-8"?> <realty-feed xmlns="http://webmaster.yandex.ru/schemas/feed/realty/2010-06"> <generation-date>$mydate</generation-date> END; // Find EZ Realty Itemid from the menu table /* $query = "SELECT * from #__menu" . "\n WHERE link = 'index.php?option=com_ezrealty'" ; $database->setQuery( $query ); $id = $database->loadResult(); $Itemid = $id; */ # Do the main database query $query = "SELECT a.price, a.freq, a.cid, a.smalldesc, a.type, a.image1, a.address2, a.street_num, a.bedrooms, squarefeet, a.totalrooms, a.bathrooms, a.frontage, a.depth, a.custom6, a.custom7, a.custom8, a.primaryschool, a.preschool, a.schooldist, a.id, a.image1desc, a.listdate, cc.name AS category, ee.ezcity AS proploc, ee.ezcity_desc AS ezdesc, dd.name AS statename, bb.name AS countryname, u.mid AS mid, u.dealer_name AS dealer_name, u.dealer_company AS dealer_company, u.dealer_phone AS dealer_phone, u.dealer_mobile AS dealer_mobile, u.dealer_email AS dealer_email, u.dealer_image AS dealer_image, u.dealer_type AS dealer_type FROM jos_ezrealty as a" . "\n LEFT JOIN jos_ezrealty_catg AS cc ON cc.id = a.cid" . "\n LEFT JOIN jos_ezrealty_locality AS ee ON ee.id = a.locid" . "\n LEFT JOIN jos_ezrealty_state AS dd ON dd.id = a.stid" . "\n LEFT JOIN jos_ezrealty_country AS bb ON bb.id = a.cnid" . "\n LEFT JOIN jos_ezrealty_profile AS u ON u.mid = a.owner" . "\n WHERE a.published=1 AND cc.published=1 AND a.stid=2 AND (a.cid=1 OR a.cid=20 OR a.cid=21 OR a.cid=23 OR a.cid=27) AND listdate > NOW() - INTERVAL 180 DAY" . "\n ORDER BY a.id DESC" ; $database = mysql_query($query) or die(mysql_error()); //Make a loop to create the feed while ($row = mysql_fetch_assoc ($database)) { // Clean up the price format for use in rss feeds $number = $row['price']; $formatted_price = number_format($number, 0,",",""); // Clean up the short description for use in rss feeds $row['smalldesc'] = preg_replace(array('/&/', '/</', '/>/', '/"/'), array('&', '<', '>', '"'), $row['smalldesc']); $row['smalldesc'] = str_replace( "'", "'", $row['smalldesc']); $row['statename'] = preg_replace(array('/&/', '/</', '/>/', '/"/'), array('&', '<', '>', '"'), $row['statename']); $row['statename'] = str_replace( "'", "'", $row['statename']); $row['address2'] = preg_replace(array('/&/', '/</', '/>/', '/"/'), array('&', '<', '>', '"'), $row['address2']); $row['address2'] = str_replace( "'", "'", $row['address2']); $row['street_num'] = preg_replace(array('/&/', '/</', '/>/', '/"/'), array('&', '<', '>', '"'), $row['street_num']); $row['street_num'] = str_replace( "'", "'", $row['street_num']); $row['image1desc'] = preg_replace(array('/&/', '/</', '/>/', '/"/'), array('&', '<', '>', '"'), $row['image1desc']); $row['image1desc'] = str_replace( "'", "'", $row['image1desc']); $row['dealer_company'] = preg_replace(array('/&/', '/</', '/>/', '/"/'), array('&', '<', '>', '"'), $row['dealer_company']); $row['dealer_company'] = str_replace( "'", "'", $row['dealer_company']); $row['dealer_phone'] = preg_replace(array('/&/', '/</', '/>/', '/"/'), array('&', '<', '>', '"'), $row['dealer_phone']); $row['dealer_phone'] = str_replace( "'", "'", $row['dealer_phone']); $row['frontage'] = preg_replace(array('/&/', '/</', '/>/', '/"/'), array('&', '<', '>', '"'), $row['frontage']); $row['frontage'] = str_replace( "'", "'", $row['frontage']); $row['depth'] = preg_replace(array('/&/', '/</', '/>/', '/"/'), array('&', '<', '>', '"'), $row['depth']); $row['depth'] = str_replace( "'", "'", $row['depth']); // Clean up the category name for use in rss feeds $row['cid2'] = preg_replace(array('/21/', '/20/', '/23/', '/27/', '/1/'), array('коммерческая', 'дом', 'участок', 'комната', 'квартира'), $row['cid']); $row['type'] = preg_replace(array('/1/', '/2/'), array('продажа', 'аренда'), $row['type']); $row['property-type'] = preg_replace(array('/коммерческая/', '/дом/', '/участок/', '/комната/', '/квартира/'), array('коммерческая', 'жилая', 'коммерческая', 'жилая', 'жилая'), $row['cid2']); $row['dealer_type'] = preg_replace(array('/1/', '/2/', '/3/', '/4/', '/5/'), array('агентство', 'владелец', 'агентство', 'владелец', 'агентство'), $row['dealer_type']); // display an item echo ' <offer internal-id="'.$row['id'].'"> <type>'.$row['type'].'</type> <property-type>'.$row['property-type'].'</property-type> <category>'.$row['cid2'].'</category> <url>http://******/index.php?option=com_ezrealty&Itemid='.$myItemid.'&task=detail&id='.$row['id'].'</url> <creation-date>'.$row['listdate'].'T00:00:00+10:00</creation-date> <location> <country>Россия</country> <region>******</region> <locality-name>******</locality-name> <sub-locality-name>'.$row['proploc'].'</sub-locality-name> <address>'.$row['address2'].' '.($row['street_num']!=='0' ? $row['street_num'] : '').'</address> </location> <sales-agent> <name>'.$row['dealer_name'].'</name> <phone>'.$row['dealer_phone'].' '.$row['dealer_mobile'].'</phone> <category>'.$row['dealer_type'].'</category> <organization>'.$row['dealer_company'].'</organization> <partner>**********</partner> </sales-agent> <price> <value>'.$formatted_price.'</value> <currency>RUB</currency> <unit>'.($row['freq']==1 ? 'кв.м' : '').'</unit> </price> <image>'.($row['image1']!='' ? 'http://***********/components/com_ezrealty/ezrealty/'.$row['image1'] : '').'</image> <area> <value>'.$row['squarefeet'].'</value> <unit>'.($row['squarefeet']!='' ? 'кв.м' : '').'</unit> </area> <living-space> <value>'.$row['totalrooms'].'</value> <unit>'.($row['totalrooms']!='' ? 'кв.м' : '').'</unit> </living-space> <kitchen-space> <value>'.$row['bathrooms'].'</value> <unit>'.($row['bathrooms']!='' ? 'кв.м' : '').'</unit> </kitchen-space> <description>'.$row['smalldesc'].'</description> <quality>'.$row['custom8'].'</quality> <rooms>'.($row['bedrooms']!=='0' ? $row['bedrooms'] : '').'</rooms> <rooms-type>'.($row['schooldist']!=='0' ? $row['schooldist'] : '').'</rooms-type> <balcony>'.($row['primaryschool']!=='0' ? $row['primaryschool'] : '').'</balcony> <bathroom-unit>'.$row['preschool'].'</bathroom-unit> <floor>'.$row['frontage'].'</floor> <floors-total>'.$row['depth'].'</floors-total> <building-type>'.$row['custom6'].'</building-type> <building-series>'.$row['custom7'].'</building-series> </offer> '; } // Close the database mysql_close(); // And end the xml file ECHO <<<END </realty-feed> END; ?>
Jekyll, а куда это вставить? Если вставляю вместо вышеуказанного кода, сразу ошибки появляются.
Затупил я, сам PHP файл в Windows-1251 сохранен был. Браузером нормально открывается, а validome.org пишет:
Документ не соответствует спецификациям.
Использованная кодировка знаков: utf-8
Source: Заданный набор знаков из заголовка HTTP протокола
Samail добавил 14.12.2010 в 23:32
Поковырял, дата то ставится, но яндекс пишет:
Что с датой не так?
Нет не проще, экспорт каждый час происходить будет.
[umka], не сработал такой вариант, "Ошибка разбора XML: синтаксическая ошибка" и всё квадратиками.
Ага, я ещё у кидал рекламу не размещал.
VMR, там один плафон кривой, а другой вообще не светит. Может ТС на новую люстру денег просит?
А чего побираешься тогда?