Page 1 of 1

Search for latest 20 newest ads

PostPosted: 20 Nov 2018, 14:13
by luckyphan
Hi,

Is there a command/link option to show the latest 20 newest ads posted regardless of the categories/locations?

Thanks.

Re: Search for latest 20 newest ads

PostPosted: 21 Nov 2018, 09:47
by Xpycm
Hi,

Code: Select all
$limit 20;
$usePagination $all $showChild false;

$criteria = new CDbCriteria;
$criteria->order 't.date_created DESC';

Yii::import('application.modules.apartments.helpers.apartmentsHelper');
$result apartmentsHelper::getApartments($limit$usePagination$all$criteria$showChild);

$apartments HApartment::findAllWithCache($result['criteria']);

var_dump(count($apartments));
var_dump($apartments);
exit; 

Re: Search for latest 20 newest ads

PostPosted: 22 Nov 2018, 10:26
by luckyphan
Sorry, perhaps my question is not really clear enough; the plan was to display the latest 20 listings on the main page - so the items displayed on the main page shall become dynamically changing whenever user visited the site & if there are new listing posted.

How to integrate the yii code you've provided above into the main page HTML ?

Thanks in advance.

Re: Search for latest 20 newest ads

PostPosted: 26 Nov 2018, 05:40
by luckyphan
Hi, Good Morning.

Can please guide how to integrate the yii codes into the main page HTML to achieve the result which I mentioned earlier?

Thanks

Re: Search for latest 20 newest ads

PostPosted: 26 Nov 2018, 16:45
by andipas
Hi,

For the theme Basis - edit files:
Code: Select all
themes/basis/views/site/index.php
themes
/basis/views/layouts/index.php