-
AuthorPosts
-
February 26, 2008 at 6:02 am #126027
Hi there,
I’m using JA NewsFlash – which is great – but I have one problem. The module rotates between articles at random, but I need it to show certain articles in a set order. Is there any way to modify the code to achieve this?
Thanks,
Matt
Khanh Le ModeratorKhanh Le
- Join date:
- November 2013
- Posts:
- 1884
- Downloads:
- 41
- Uploads:
- 31
- Thanks:
- 44
- Thanked:
- 203 times in 131 posts
February 26, 2008 at 10:34 am #240209Here is the solution: http://www.joomlart.com/forums/topic/ja-newsflash-news-ordering/
February 26, 2008 at 4:37 pm #240254Hi,
Thanks for the response, but my version of JA News Flash (for J1.5, from Corona), does not have the code you mentioned. There’s a slightly different code there:
if ( $numrows ) {
if (!JArrayHelper::getValue($_GET,’loadajax’,0)) {
$flashnum = 0;
srand ((double) microtime() * 1000000);
$flashnum = rand( 0, $numrows-1 );
}
$row = $rows[$flashnum];
}And when I tried to replace this with the code you suggested, I got the following error:
Fatal error: Call to undefined function mosgetparam() in /home/russia11/public_html/modules/mod_janewsflash/ja_newsflash/ja-newsflashloader.php on line 276
Any ideas?
Thanks,
Matt
Khanh Le ModeratorKhanh Le
- Join date:
- November 2013
- Posts:
- 1884
- Downloads:
- 41
- Uploads:
- 31
- Thanks:
- 44
- Thanked:
- 203 times in 131 posts
February 27, 2008 at 3:49 am #240317You don’t tell me the version of your Joomla, so I assume that is Joomla 1.0x.
Here is the solution for your JA newsflash module in Joomla 1.5:Replace above code:
if ( $numrows ) {
if (!JArrayHelper::getValue($_GET,'loadajax',0)) {
$flashnum = 0;
srand ((double) microtime() * 1000000);
$flashnum = rand( 0, $numrows-1 );
}
$row = $rows[$flashnum];
}
with
if ( $numrows ) {
if (isset ($_REQUEST['curnews'])) {
$curnews = intval( JRequest::getCmd( 'curnews' ));
$flashnum = ($curnews + 1) < $numrows ? $curnews + 1 : 0;
}else{
$flashnum = 0;
}
$row = $rows[$flashnum];
}
February 27, 2008 at 5:41 am #240332Thank you – excellent support!
Khanh Le ModeratorKhanh Le
- Join date:
- November 2013
- Posts:
- 1884
- Downloads:
- 41
- Uploads:
- 31
- Thanks:
- 44
- Thanked:
- 203 times in 131 posts
February 27, 2008 at 7:27 am #240345You’re welcome, mattwrigley.
Also there’s Thanks button bottom of the post to say thank you. 😉February 27, 2008 at 11:21 pm #240481Hi,
Actually, the module is still displaying the articles in a random order, although I’ve updated the code as you said.Anything I can do?
Thanks.
Khanh Le ModeratorKhanh Le
- Join date:
- November 2013
- Posts:
- 1884
- Downloads:
- 41
- Uploads:
- 31
- Thanks:
- 44
- Thanked:
- 203 times in 131 posts
February 28, 2008 at 7:29 am #240524Really? Can you PM some information about your site: url, ftp account, admin account. I will take a look.
Khanh Le ModeratorKhanh Le
- Join date:
- November 2013
- Posts:
- 1884
- Downloads:
- 41
- Uploads:
- 31
- Thanks:
- 44
- Thanked:
- 203 times in 131 posts
February 29, 2008 at 3:56 am #240710Please make a change in file ja_newsflash/ja-scroll.js:
Search this code (at the very top of file):
//get a random number
var news = 0;
var i = 10;
while (--i > 0)
{
news = Math.floor(jaNewsflash.totalItem*Math.random());
if(news != jaNewsflash.currentItem) break;
}
and change to
jaNewsflash.currentItem = (jaNewsflash.currentItem>=jaNewsflash.totalItem)?0:(jaNewsflash.currentItem+1);
March 1, 2008 at 11:06 pm #240949Hi again,
I really appreciate your help so far, but the module is still displaying in random order, despite the fact I have made all the changes you suggested.
Do you have a final solution?
Thanks,
Matt
Khanh Le ModeratorKhanh Le
- Join date:
- November 2013
- Posts:
- 1884
- Downloads:
- 41
- Uploads:
- 31
- Thanks:
- 44
- Thanked:
- 203 times in 131 posts
March 2, 2008 at 4:28 pm #240993I see that you have only 2 news display on this module so it always displays continuously. You need add more news to check if it displays in random or not.
Above is my final solutions and I’m sure it works. You must apply both fixes in 2 files guided above. You also need clear cache to make sure that your browser does not cache the js file.
Grumpster FriendGrumpster
- Join date:
- June 2006
- Posts:
- 14
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 8 times in 1 posts
March 5, 2009 at 8:17 pm #294603I tried both the suggested code replacements for v1.5, but couldn’t get it to work.
The first code replacement in the ja-newsflashloader.php file did make the first article (as ordered in the Article Manager) appear first when the site was loaded. After that, the images were coming up in random order. I cleared my cache several times (I’m using Firefox), but still it didn’t work.
I then put in the code replacement suggested for the ja-scroll.js file, but that only locked up the image rotation completely. It did, however, display the first Newsflash article in the order, but like I say, no other images rotated after that.
I was using it on the JA_Iolite template, but it’s the same JA_Newsflash module v1.0.0.
September 24, 2009 at 8:22 pm #318478khan le, thanks for your help. I did not understand in your post about the replacement of ja-scroll which code exactly has to be replaced by which new code… cause also in my case the thing does not work and my articles have to be absolutely in fix (and not random) order…
Thanks, TomBob Meetin FriendBob Meetin
- Join date:
- September 2014
- Posts:
- 130
- Downloads:
- 0
- Uploads:
- 12
- Thanks:
- 6
- Thanked:
- 5 times in 1 posts
October 28, 2009 at 11:40 pm #321967My experience is identical with what Grumpster described. After installing the first fix, the first slide shows first, then after that it goes random; in fact the first slide may show again before all the other slides have displayed.
It locks up after updating ja-scroll.js. Can you show us an example of it working properly with these two fixes in place, nothing else changed?
Bob Meetin FriendBob Meetin
- Join date:
- September 2014
- Posts:
- 130
- Downloads:
- 0
- Uploads:
- 12
- Thanks:
- 6
- Thanked:
- 5 times in 1 posts
November 2, 2009 at 9:25 pm #322370This does not seem like it should be that complicated to someone who knows the module. Does anyone have a working example to post along with the code changes to make it work?
-
AuthorPosts
This topic contains 18 replies, has 7 voices, and was last updated by cybr2th 14 years, 6 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum