Questions and answers about change of functions, design, hosting etc.
Moderators: Koduc, Xpycm
Forum rules
Pay attention! Forum is not a means for guaranteed support of clients and users. An answer as well as a quick answer is not supposed on the forum. We post messages as soon as possible.
The message limit on the forum is 3 messages per day.
If you want to say "thank you" then use the function "Give good reputation point", which is a green icon "plus" under the nickname of the person, who answered the message.
by luckyphan » 20 Nov 2018, 14:13
Hi,
Is there a command/link option to show the latest 20 newest ads posted regardless of the categories/locations?
Thanks.
-
luckyphan
- Stranger
-
- Posts: 24
- Joined: 30 Jul 2018, 09:09
- Reputation point: 0
by Xpycm » 21 Nov 2018, 09:47
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;
-
Xpycm
- Web Developer
-
- Posts: 281
- Joined: 30 Dec 2011, 11:06
- Reputation point: 2
-
by luckyphan » 22 Nov 2018, 10:26
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.
-
luckyphan
- Stranger
-
- Posts: 24
- Joined: 30 Jul 2018, 09:09
- Reputation point: 0
by luckyphan » 26 Nov 2018, 05:40
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
-
luckyphan
- Stranger
-
- Posts: 24
- Joined: 30 Jul 2018, 09:09
- Reputation point: 0
by andipas » 26 Nov 2018, 16:45
Hi,
For the theme Basis - edit files:
- Code: Select all
themes/basis/views/site/index.php
themes/basis/views/layouts/index.php
-
andipas
- Web Developer
-
- Posts: 156
- Joined: 28 Dec 2011, 22:37
- Reputation point: 1
Return to Questions and help for changes
Who is online
Users browsing this forum: No registered users and 55 guests