Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • mattwrigley Friend
    #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 Moderator
    #240209
    mattwrigley Friend
    #240254

    Hi,

    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 Moderator
    #240317

    You 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];
    }

    mattwrigley Friend
    #240332

    Thank you – excellent support!

    Khanh Le Moderator
    #240345

    You’re welcome, mattwrigley.
    Also there’s Thanks button bottom of the post to say thank you. 😉

    mattwrigley Friend
    #240481

    Hi,
    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 Moderator
    #240524

    Really? Can you PM some information about your site: url, ftp account, admin account. I will take a look.

    Khanh Le Moderator
    #240710

    Please 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);

    mattwrigley Friend
    #240949

    Hi 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 Moderator
    #240993

    I 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 Friend
    #294603

    I 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.

    tleisibach Friend
    #318478

    khan 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, Tom

    Bob Meetin Friend
    #321967

    My 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 Friend
    #322370

    This 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?

Viewing 15 posts - 1 through 15 (of 18 total)

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