test
Viewing 1 post (of 1 total)
  • Author
    Posts
  • zorroson Friend
    #151708

    Hi all,

    I had a situation, where I needed mod_jacatslwi to show images and links to articles, from only specific featured articles from my categories – kinda like JA Slideshow2 has a “featured” option.

    So – with inspiration fra JA Slideshow2 , I made the following changes in JA catslwi (mod_jacatslwi):

    Open http://yourdomain/modules/mod_jacatslwi/mod_jacatslwi.xml and change:


    <params addpath="/modules/mod_jacatslwi/elements">
    <param name="@group" type="japaramhelper" value="thumbnail_mode" hiderow="true" default=" " label=" " description=" " />
    <param name="moduleclass_sfx" type="text" default="" label="MODULE CLASS SUFFIX" description="MODULE CLASS SUFFIX DESC" />
    <param name="@spacer" type="spacer" default="" label="" description="" />
    <param name="catid" type="category" default="" label="CATEGORY IDS" description="CATEGORY IDS DESC" />

    to:


    <params addpath="/modules/mod_jacatslwi/elements">
    <param name="@group" type="japaramhelper" value="thumbnail_mode" hiderow="true" default=" " label=" " description=" " />
    <param name="moduleclass_sfx" type="text" default="" label="MODULE CLASS SUFFIX" description="MODULE CLASS SUFFIX DESC" />
    <param name="@spacer" type="spacer" default="" label="" description="" />

    <param name="source-articles-display_model" type="radio" default="" label="Display mode" description="Show articles based on keyword or categories?">
    <option value="metakeyword">Use featured keyword</option>
    <option value="">From categories</option>
    </param>
    <param name="keyword" type="text" default="featured" label="Keyword" description="Show articles with this keyword in metadata keyword field in article." />

    <param name="catid" type="category" default="" label="CATEGORY IDS" description="CATEGORY IDS DESC" />

    and then open http://yourdomain/modules/mod_jacatslwi/helper.php and change:

    // query to determine article count
    $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' .
    ' WHERE a.state = 1 ' .
    ($noauth ? ' AND a.access <= ' .(int) $aid. ' AND cc.access <= ' .(int) $aid. ' AND s.access <= ' .(int) $aid : '').
    ' AND (a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' ) ' .
    ' AND (a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )' .
    (($catid) ? ' AND cc.id IN (' . $catid . ') ' : '').
    ' AND cc.section = s.id' .
    ' AND cc.published = 1' .
    ' AND s.published = 1' ;

    to:

    if ( $params->get('source-articles-display_model') == 'metakeyword' ) {
    $keyword = $params->get('keyword','');
    } else {
    $keyword = '';
    }

    // query to determine article count
    $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' .
    ' WHERE a.state = 1 ' .
    " AND a.metakey LIKE '%" . $keyword . "%' " .
    ($noauth ? ' AND a.access <= ' .(int) $aid. ' AND cc.access <= ' .(int) $aid. ' AND s.access <= ' .(int) $aid : '').
    ' AND (a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' ) ' .
    ' AND (a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )' .
    (($catid) ? ' AND cc.id IN (' . $catid . ') ' : '').
    ' AND cc.section = s.id' .
    ' AND cc.published = 1' .
    ' AND s.published = 1' ;

    After this open your mod_jacatslwi module in Module Manager in Joomla backend, set/change module settings and save. Now just add the metadata keyword(s) you specified in the module to your articles, and voila!

    Tip: If you copy the module in Module Manager, you can even show the same article in different modules, just by configuring your modules with different keywords and then add multiple keywords in your article metadata keyword.

    Cheers,
    Zorroson 🙂

Viewing 1 post (of 1 total)

This topic contains 1 reply, has 1 voice, and was last updated by  zorroson 14 years, 6 months ago.

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