0

I need to use two article latest news module in my joomla 2.5 website. In one module I want to show the last article, while in the second module I want to show the second last article. How can i set this param? I try to edit the helper.php of mod_articles_news module, but I don't know how to set this param. I suppose I have to add a line like this

$model->setState('somwthing', param);

but the problem is that I don't know what I have to write. I can use as param variable the variable that rapresent the number of article to show in the module, because i force it to show only one article per module so that param is useless now. Thanks.

pindol
  • 2,110
  • 6
  • 35
  • 52

2 Answers2

0

Check with this

mod_modulename.php:

require_once (dirname(__FILE__).DS.'helper.php');

$news   = modxxxxHelper::getlatestarticles();   

helper.php

class modxxxxHelper
{
    function getlatestarticles()
    {
        $db     =& JFactory::getDBO();  
        $query = 'SELECT title FROM #__content WHERE state = 1 ORDER BY id desc limit 0,1';

        $db->setQuery($query);
        $result = $db->loadResult();        

        return $result;
    }

}

default.php

<?php echo $news; ?>
Mohammed Nagoor
  • 884
  • 2
  • 12
  • 25
0

You can do this using the module settings itself.

Start by creating 2 'Latest Articles' or 'Latest News' modules.

For your last article, open the module settings in the backend:

  • Set 'Count' to '1'
  • Set 'Order' to 'Recently Added First'

For your second article, open the module settings in the backend: - Set 'Count' to '1' - Set 'Order' to 'Recently Modified First'

Then, open the article you want to display as second, add a space at the end of sentence or something and resave. This will change the modified timestamp to most recent causing it display for the second module for your second article