Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Saguaros Moderator
    #143217

    Hello Everybody!

    – I have done a feature for the JA News 1.3.1 Module:
    + Display Time of creation and author with each article’s title.
    + Control enable, disable them in JA News’ configuration, allow override by article’s configuration.

    – Now, I want to share my tip with you.

    – I have attached 3 files:
    + mod_janews.zip: this package was modified.
    + 2 screenshot: you see it how work.

    – I will guide you to complete this work:
    1) You open file modulesmod_janewsmod_janews.xml:
    a) add this after line 72:
    [PHP]

    <param name=”show_author” type=”radio” default=”1″ label=”Author Names” description=”TIPIFSETTOSHOWAUTHOR”>
    <option value=”0″>Hide</option>
    <option value=”1″>Show</option>
    </param>
    <param name=”show_create_date” type=”radio” default=”1″ label=”Created Date and Time” description=”TIPIFSETTOSHOWDATETIMECREATED”>
    <option value=”0″>Hide</option>
    <option value=”1″>Show</option>
    </param>
    <param name=”show_modify_date” type=”radio” default=”1″ label=”Modified Date and Time” description=”TIPIFSETTOSHOWDATETIMEMODIFIED”>
    <option value=”0″>Hide</option>
    <option value=”1″>Show</option>
    </param>
    [/PHP]

    2) You open file: modulesmod_janewshelper.php:
    a) at line 209 => 215:
    [PHP]
    $query = ‘SELECT a.*,cc.description as catdesc, cc.title as cattitle,s.description as secdesc, s.title as sectitle,’ .
    ‘ CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(“:”, a.id, a.alias) ELSE a.id END as slug,’.
    ‘ CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(“:”, cc.id, cc.alias) ELSE cc.id END as catslug,’.
    ‘ CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(“:”, s.id, s.alias) ELSE s.id END as secslug’.
    ‘ FROM #__content AS a’ .
    ‘ INNER JOIN #__categories AS cc ON cc.id = a.catid’ .
    ‘ INNER JOIN #__sections AS s ON s.id = a.sectionid’;
    [/PHP]
    ==> replace :
    [PHP]$query = ‘SELECT a.*,cc.description as catdesc, cc.title as cattitle,s.description as secdesc, s.title as sectitle,’ .
    ‘ u.name AS author, u.usertype , u.email as author_email, ‘.
    ‘ CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(“:”, a.id, a.alias) ELSE a.id END as slug,’.
    ‘ CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(“:”, cc.id, cc.alias) ELSE cc.id END as catslug,’.
    ‘ CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(“:”, s.id, s.alias) ELSE s.id END as secslug’.
    ‘ FROM #__content AS a’ .
    ‘ INNER JOIN #__categories AS cc ON cc.id = a.catid’ .
    ‘ INNER JOIN #__sections AS s ON s.id = a.sectionid’ .
    ‘ LEFT JOIN #__users AS u ON u.id = a.created_by ‘;[/PHP]

    b) add this in line 21:
    [PHP]
    function escape($string) {
    return str_replace(‘;’,”;”,$string);
    }
    [/PHP]
    3) You open modulesmod_janewstmplblog_item.php
    a) at line 40 :
    [PHP] //Show the latest news[/PHP]
    ==> replace:

    [PHP]//Show the latest news
    $row->params = clone($params);
    $aparams = new JParameter($row->attribs);
    // Merge article parameters into the page configuration
    $row->params->merge($aparams);
    [/PHP]
    b) at line 43 (original)
    [PHP] <h4 class=”jazin-title”><a href=”<?php echo $link;?>” title=”<?php echo strip_tags($row->title);?>”><?php echo $row->title;?></a></h4>[/PHP]
    ==> replace:
    [PHP]<h4 class=”jazin-title”><a href=”<?php echo $link;?>” title=”<?php echo strip_tags($row->title);?>”><?php echo $row->title;?></a></h4>
    <?php if (($row->params->get(‘show_create_date’))
    || (($row->params->get(‘show_author’)) && ($row->author != “”)) ) :
    ?>
    <div class=”article-tools clearfix”>
    <div class=”article-meta”>
    <?php if ($row->params->get(‘show_create_date’)) : ?>
    <span class=”createdate”>
    <?php echo JHTML::_(‘date’, $row->created, JText::_(‘DATE_FORMAT_LC2’)); ?>
    </span>
    <?php endif; ?>
    <?php if (($row->params->get(‘show_author’)) && ($row->author != “”)) : ?>
    <span class=”createby”>
    <?php JText::printf(($row->created_by_alias
    ? modJaNewsHelper::escape($row->created_by_alias)
    : modJaNewsHelper::escape($row->author)) ); ?>
    </span>
    <?php endif; ?>
    </div>
    </div>
    <?php endif; ?>[/PHP]

    c) at line 54 => 56 (original)
    [PHP]<?php if ($showreadmore) : ?>
    <a href=”<?php echo $link; ?>” class=”readon” title=”<?php echo JText::sprintf(‘Read more…’);?>”><?php echo JText::sprintf(‘Read more…’);?></a>
    <?php endif; ?>[/PHP]

    ==> replace :
    [PHP]<?php if ( intval($row->modified) != 0 && $row->params->get(‘show_modify_date’)) : ?>
    <p class=”modifydate clearfix”>
    <?php echo JText::sprintf(‘LAST_UPDATED2’, JHTML::_(‘date’, $row->modified, JText::_(‘DATE_FORMAT_LC2’))); ?>
    </p>
    <?php endif; ?>
    <?php if ($showreadmore) : ?>
    <a href=”<?php echo $link; ?>” class=”readon” title=”<?php echo JText::sprintf(‘Read more…’);?>”><?php echo JText::sprintf(‘Read more…’);?></a>
    <?php endif; ?>[/PHP]

    ======> that’s all !

    ginza Friend
    #314070

    I believe the code that you have provided was for J15. Can this be use for J10. If not can you please provide the code to show the author and date for J10.

    Saguaros Moderator
    #314186

    Hello ginza!

    This code has only use for JL 1.5, i do’nt sure it can use for JL 1.0.

    I suggest you should using the lastest version, JA has built this feature for the JA News Module.

    sss300300 Friend
    #315967

    thanks

    i replace helper.php with u file Attached

    very nice

Viewing 4 posts - 1 through 4 (of 4 total)

This topic contains 4 replies, has 3 voices, and was last updated by  sss300300 14 years, 8 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum