Пример #1
0
function search_apartments($keyword, $sleeps, $page)
{
    error_log("page: {$page}");
    $conn = db_connect();
    $resultSet = new Property_Dom_ResultSet();
    if (!empty($keyword)) {
        $keyword = '%' . $keyword . '%';
    }
    $limit_count = 30;
    $limit_start = ($page - 1) * $limit_count;
    if (empty($keyword)) {
        $sql = "SELECT * FROM apartments where description like '%Sleeps {$sleeps}%' order by id asc limit {$limit_start}, {$limit_count}";
    } else {
        $sql = "SELECT * FROM apartments where (title like '{$keyword}' OR description2 like '{$keyword}') AND description like '%Sleeps {$sleeps}%' order by id asc limit {$limit_start}, {$limit_count}";
    }
    //echo $sql;die;
    error_log("Query: " . $sql);
    $result = mysql_query($sql);
    $i = 0;
    while ($row = mysql_fetch_assoc($result)) {
        $resultSet->addTitleByIndex($i, html_entity_decode($row['title']));
        $resultSet->addDescriptionByIndex($i, html_entity_decode($row['description']));
        $resultSet->addDescriptionByIndex($i, $row['description2']);
        $resultSet->addPropertyImageLinkByIndex($i, $row['thumb_url']);
        $resultSet->addPropertyDetailLinkByIndex($i, $row['detail_url']);
        $i++;
    }
    mysql_free_result($result);
    return $resultSet;
}
Пример #2
0
//		echo $page->textContent;

	}*/
$i = 0;
foreach ($headings as $heading) {
    $result = new Property_Dom_Result();
    $result->type = 'PAID';
    $result->position = $i + 1;
    $resultSet->addResult($result);
    $resultSet->addTitleByIndex($i, $heading->textContent);
    $i++;
}
$i = 0;
foreach ($descriptions as $description) {
    $resultSet->addDescriptionByIndex($i, $description->textContent);
    $i++;
}
$i = 0;
foreach ($descriptions2 as $description2) {
    $resultSet->addDescriptionMoreByIndex($i, $description2->textContent);
    $i++;
}
$i = 0;
$img_urls = array();
foreach ($detail_urls as $link) {
    $url = $link->getAttribute('href');
    $featured[$i] = 0;
    if (strpos($url, '?featured=1') !== FALSE) {
        $featured[$i] = 1;
        $url = str_replace('?featured=1', '', $url);