-
AuthorPosts
-
May 4, 2011 at 3:37 pm #163580
Hi!
JA News2 show all the category by order/date only.
I have 10 category, only the first 3 category appear at the News2, the rest of the 7 category will never appear on the front page.
I want these category appear randomly, which it’ll display 3 randomly on everytime.
How can I make it like this?
Please help-THXSorry for my english
thangnn1510 Friendthangnn1510
- Join date:
- October 2014
- Posts:
- 1608
- Downloads:
- 0
- Uploads:
- 80
- Thanks:
- 73
- Thanked:
- 278 times in 256 posts
May 6, 2011 at 2:27 am #390054Hi Jedileong!
You could do it yourself by some small customizations (I’ll be done in code). Please go to modulesmod_janews2helper.php and find this code:
$query = "SELECT `id`, `title`, `description`, CASE WHEN CHAR_LENGTH(`alias`) THEN CONCAT_WS(":", `id`, `alias`) ELSE `id` END as `slug` FROM `#__categories` s WHERE published = 1 and section=" . ( int ) $sid . $where .' ORDER BY s.ordering';
change to:
$query = "SELECT `id`, `title`, `description`, CASE WHEN CHAR_LENGTH(`alias`) THEN CONCAT_WS(":", `id`, `alias`) ELSE `id` END as `slug` FROM `#__categories` s WHERE published = 1 and section=" . ( int ) $sid . $where .' ORDER BY RAND()';
That will help.
May 6, 2011 at 4:04 pm #390134Thank you!!
but there come another issue, i have 4 section in the JA News2, i only want the first 2 section to appear randomly, another 2 section order by default. How can i make like this? The first 2 section ID is 14 & 13, another 2 section ID is 12 & 8.Many thanks for your assistance!
thangnn1510 Friendthangnn1510
- Join date:
- October 2014
- Posts:
- 1608
- Downloads:
- 0
- Uploads:
- 80
- Thanks:
- 73
- Thanked:
- 278 times in 256 posts
May 10, 2011 at 7:02 am #390505You could change the code I suggested Above to
if(($sid==13)||($sid==14)){
$query = "SELECT `id`, `title`, `description`, CASE WHEN CHAR_LENGTH(`alias`) THEN CONCAT_WS(":", `id`, `alias`) ELSE `id` END as `slug` FROM `#__categories` s WHERE published = 1 and section=" . ( int ) $sid . $where .' ORDER BY RAND()';
}else{
$query = "SELECT `id`, `title`, `description`, CASE WHEN CHAR_LENGTH(`alias`) THEN CONCAT_WS(":", `id`, `alias`) ELSE `id` END as `slug` FROM `#__categories` s WHERE published = 1 and section=" . ( int ) $sid . $where .' ORDER BY s.ordering';
}That will help you in this case.
1 user says Thank You to thangnn1510 for this useful post
May 19, 2011 at 3:53 am #391887thanks thangnn! it work perfectly!
AuthorPostsViewing 5 posts - 1 through 5 (of 5 total)This topic contains 5 replies, has 2 voices, and was last updated by jedileong 13 years, 6 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
JA News2 – show all the category randomly
Viewing 5 posts - 1 through 5 (of 5 total)