test
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • DominicMaricic Friend
    #146741

    Using Joomla 1.5 and the latest JA News, is there any way to use the category image for the categories rather than an image within the article? Not all our articles have images and it would be easier just to use the category image instead.

    DominicMaricic Friend
    #326390

    It’s been a few days. Any ideas for this?

    Saguaros Moderator
    #326431

    Hello DominicMaricic!

    The ja new does not work as your expected. Please try to looking for a extension in the extensions joomla , may be you have it to use for your idea.:)

    DominicMaricic Friend
    #326433

    It seems like it would be an easy change. Just use the category image rather than an image within the article itself. The rest of the component works great. Does anyone know have an answer other than look elsewhere? I can’t believe that no one wants this, not every article has an image.

    DominicMaricic Friend
    #328342

    Still nothing on this? I’ve had a ticket open for almost a month.

    Saguaros Moderator
    #328372

    Dear guy!

    I’m sorry for this,

    now, please open the file: modulesmod_janewshelper.php and try to find the “getList” function:
    [PHP]
    function getList($catorsec, $catid, $items, $ordering, $showcontentfrontpage = false) {
    // code here
    }
    [/PHP]
    You try to find the sql query in the function:
    [PHP]
    $query = ‘SELECT a.*,u.name as creater, 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’ . ‘ left JOIN #__users AS u ON a.created_by = u.id’;
    $query .= ‘ 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 ) . ‘ )’ . (($catorsec) ? “n AND cc.id=” . ( int ) $catid : ‘ AND s.id=’ . ( int ) $catid) . ‘ AND cc.section = s.id’ . ‘ AND cc.published = 1’ . ‘ AND s.published = 1’;
    [/PHP]
    +>> You replace:
    [PHP]
    $query = ‘SELECT a.*,u.name as creater,s.image as simage, cc.image as cimage, 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’ . ‘ left JOIN #__users AS u ON a.created_by = u.id’;
    $query .= ‘ 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 ) . ‘ )’ . (($catorsec) ? “n AND cc.id=” . ( int ) $catid : ‘ AND s.id=’ . ( int ) $catid) . ‘ AND cc.section = s.id’ . ‘ AND cc.published = 1’ . ‘ AND s.published = 1’;
    [/PHP]

    2) you open the file modulesmod_janewstmplblog_item.php and find codes:
    [PHP]$image = modJANewsHelper::replaceImage ($row, $img_align, $params, $maxchars, $s_showimage, $img_w, $img_h, $hiddenClasses);[/PHP]
    => replace:
    [PHP]
    $tr = ‘#<s*img [^>]*srcs*=s*([“‘])(.*?)1#im’;
    $match=null;
    preg_match ( $tr, $row->introtext. $row->fulltext, $match );
    //Show the latest news
    if( !$match ){
    $tmpLink = $catorsec ? $row->cimage:$row->simage;
    $image = !$tmpLink ? ” :'<img src=”‘.’images/stories/’.$tmpLink.'” />’;
    $row->introtext = $image. $row->introtext;
    }
    $image = modJANewsHelper::replaceImage ($row, $img_align, $params, $maxchars, $s_showimage, $img_w, $img_h, $hiddenClasses);
    [/PHP]

    good luck

    DominicMaricic Friend
    #328373

    Hi Tienhc,

    Thank you for helping. I changed both files as above and the images went away but the category images did not appear ( I made sure to have a few set). Was there anything else that has to be changed?

    Saguaros Moderator
    #328380

    Hello guy!

    i forget explain more detail about my changes:

    The image of categories or the image of section only was displayed if the article have not any image.
    I tried to test my codes on the two sites again, the module is workded well on our site after modified codes.

    6623
    Option 1:
    These codes display the image base on the “Group by Category or Section” parameter
    [PHP]
    $tr = ‘#<s*img [^>]*srcs*=s*([“‘])(.*?)1#im’;
    $match=null;
    preg_match ( $tr, $row->introtext. $row->fulltext, $match );
    //Show the latest news
    if( !$match ){
    $tmpLink = $catorsec ? $row->cimage:$row->simage;
    $image = !$tmpLink ? ” :'<img src=”‘.’images/stories/’.$tmpLink.'” />’;
    $row->introtext = $image. $row->introtext;
    }
    $image = modJANewsHelper::replaceImage ($row, $img_align, $params, $maxchars, $s_showimage, $img_w, $img_h, $hiddenClasses);
    [/PHP]
    Option 2: without the “Group by Category or Section” parameter
    [PHP]
    $tr = ‘#<s*img [^>]*srcs*=s*([“‘])(.*?)1#im’;
    $match=null;
    preg_match ( $tr, $row->introtext. $row->fulltext, $match );
    //Show the latest news
    if( !$match ){
    $image = !$row->cimage ? ” :'<img src=”‘.’images/stories/’.$row->cimage.'” />’;
    $row->introtext = $image. $row->introtext;
    }
    $image = modJANewsHelper::replaceImage ($row, $img_align, $params, $maxchars, $s_showimage, $img_w, $img_h, $hiddenClasses);
    [/PHP]

    chanton Friend
    #328396

    I also tried your code in JA News2, but category just never show when article has no image. what’s wrong?

    Is it because your code is for JA News instead of Ja New2 (based on your screenshot)

    also I could not find the code your mentioned

    [PHP]$image = modJANewsHelper::replaceImage ($row, $img_align, $params, $maxchars, $s_showimage, $img_w, $img_h, $hiddenClasses); [/PHP]

    but found this one. I guess it’s the same.
    [PHP]$image = $helper->replaceImage ($row, $img_align, $autoresize, $maxchars, $s_showimage, $img_w, $img_h, $hiddenClasses);[/PHP]

    Saguaros Moderator
    #328411

    ahhh, yes. I only make for the ja new, not the ja news 2. so please give me some times, i ‘ll try to do this and give you the solution 🙂

    chanton Friend
    #328424

    You are the best!

    Saguaros Moderator
    #328522

    Hello guys

    The solution for ja news 2: checkout here: http://www.joomlart.com/forums/showthread.php?p=148887#post148887

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

This topic contains 12 replies, has 3 voices, and was last updated by  Saguaros 14 years, 11 months ago.

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