Forum Moderators: open
function vivareal()
{
$db=& JFactory::getDBO();
$query = ' SELECT p.*,c.name as name_category,t.name as name_type,cy.name as name_country,s.name as name_state,l.name as name_locality,pf.name as name_profile, '
. ' CASE WHEN CHAR_LENGTH(p.alias) THEN CONCAT_WS(":", p.id, p.alias) ELSE p.id END as Pslug,'
. ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as Cslug,'
. ' CASE WHEN CHAR_LENGTH(cy.alias) THEN CONCAT_WS(":", cy.id, cy.alias) ELSE cy.id END as CYslug,'
. ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as Sslug,'
. ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(":", l.id, l.alias) ELSE l.id END as Lslug, '
. ' CASE WHEN CHAR_LENGTH(t.alias) THEN CONCAT_WS(":", t.id, t.alias) ELSE t.id END as Tslug '
. ' FROM #__properties_products AS p '
. ' LEFT JOIN #__properties_country AS cy ON cy.id = p.cyid '
. ' LEFT JOIN #__properties_state AS s ON s.id = p.sid '
. ' LEFT JOIN #__properties_locality AS l ON l.id = p.lid '
. ' LEFT JOIN #__properties_profiles AS pf ON pf.mid = p.agent_id '
. ' LEFT JOIN #__properties_category AS c ON c.id = p.cid '
. ' LEFT JOIN #__properties_type AS t ON t.id = p.type '
. ' WHERE p.published = 1 '
. ' AND p.cid IN(17,18,19,20) '
.' ORDER BY p.id DESC '
;
$db->setQuery( $query );
$products = $db->loadObjectList();
$crlf="\n";
$line = '<?xml version="1.0" encoding="utf-8"?>' . $crlf;
$line .= '<imoveis>'. $crlf;
foreach ( $products as $row )
{
$url = substr(JURI::base(), 0, -1);
$link = $url.LinkHelper::getLink('properties','showproperty','',$row->CYslug,$row->Sslug,$row->Lslug,$row->Cslug,$row->Tslug,$row->Pslug);
$title = $this->escape( $row->name );
//$category = JText::_('TROVIT_CAT_'.$row->name_category);
//$category = 'For Sale';
$price = number_format($row->price, 2,",",".");
$imageBaseUrl = JURI::root().'images/properties/images/';
$imageUrl = $imageBaseUrl.$row->id.'/';
$images=$this->Images($row->id);
$listdate = JFactory::getDate($row->listdate)->toFormat('%d/%m/%Y');
$nomedaimobiliaria='example.com - Portais Imobiliários de Florianópolis e SC';
$urldaimobiliaria=JURI::root();
$tipo='RESIDENCIAL';
/*
Apartamentos17
Casas 18
Casas em condominios 19
Coberturas 20
*/
switch($row->cid)
{
case 17:
$subtipo='APARTAMENTO';
break;
case 18:
$subtipo='CASA';
break;
case 19:
$subtipo='CASA';
break;
case 20:
$subtipo='COBERTURA';
break;
}
/*$line.='<>'.$row->.'</>' . $crlf;*/
$line.='<imovel>'. $crlf;
$line.='<statusdoimovel>a venda</statusdoimovel>' . $crlf;
$line.='<localizacao>' . $crlf;
$line.='<endereco>'.$row->name_locality.'</endereco>' . $crlf;
$line.='<bairro>'.$row->name_locality.'</bairro>' . $crlf;
$line.='<cidade>'.$row->name_state.'</cidade>' . $crlf;
[edited by: httpwebwitch at 2:20 am (utc) on Jun 10, 2011]
å,e,i,ø,u
a,e,i,o,u
I must ask: why are you removing accented characters? If your text is "Lagoa da Conceição", shouldn't it stay that way? If you're only removing accents so your XML validates, use htmlentities() instead.
I don't know what happened there
[edited by: httpwebwitch at 1:04 am (utc) on Jun 11, 2011]
[edit reason] removed specifics [/edit]