B
B
boxxxer2014-03-15 11:19:36
Joomla
boxxxer, 2014-03-15 11:19:36

Joomla - how to style the latest news?

Joomla 2.5
It is planned to display 5 latest news in the sidebar. I did the following: I created a category for materials, then added 5 news to this category, went to the module manager and added a module of the type Materials - News (displays a given number of news from the selected category) in the template I registered the output of the module through for the STYLE
tag created a new style under called NEWS Also in the style folder I created the html folder and in it I already created the modules.php file

<?php
defined('_JEXEC') or die('Restricted access');
function modChrome_news($module, $params, $attribs){
    echo "<pre>";
    print_r($module);
    echo "</pre>";exit;
    if (!empty ($module->content)) : ?>
        <div>
            <?php echo $module->content; ?>
        </div>
    <?php endif;
}
?>

But when I make a $module output, then firstly all the news they go together in one variable, as it were, I need to be able to process each news separately, let's say, take each news in a div with the news class, then add styles for this class, I also need that for each news I can separately receive data on the time of its publication, the author, the first picture, so that in general I can completely control the arrangement of elements in the template, how can I do what I described above, tell me, knowledgeable people?
Here is an example of what the $module variable outputs (2 materials go together, I can't process each material separately).
stdClass Object
(
    [id] => 100
    [title] => Новости
    [module] => mod_articles_news
    [position] => potolki-sidebar-news
    [content] => 

Описание новой новости Описание новой новости Описание новой новости <b>(1 материал)</b>

Описание новой новости Описание новой новости Описание новой новости <b>( 2 материал)</b>


    [showtitle] => 1
    [params] => {"catid":["78"],"image":"0","item_title":"0","link_titles":"","item_heading":"h4","showLastSeparator":"1","readmore":"0","count":"5","ordering":"a.publish_up","layout":"_:default","moduleclass_sfx":"","cache":"1","cache_time":"900","cachemode":"itemid"}
    [menuid] => 0
    [user] => 0
    [name] => articles_news
    [style] => news
)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Yakushev, 2014-03-23
@CanVas

modules\mod_articles_news\tmpl
if your module is "mod_articles_news", then there will be php files of the module template. in the same place, in my opinion, you can create your own templates ... I'm not sure exactly

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question