Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • sushismb Friend
    #145183

    Hello,

    Just wanted to know if there is a way to enable “category image” to show under the category title in JA News2.

    I don’t see it in the backend module settings. I was wondering if there is any way to customize to allow what I want.

    Thanks!

    sushismb Friend
    #320540

    I’d like to do the above because of the following reasons;

    * I have few sections that has multiple categories but only 1 category with an article. Instead of having a blank space in it, I thought it would be nice to at least have a category image to fill the gap.

    * Not all articles have images/photos. To make the look consistent, it would be nice to have images in all categories.

    I hope there is any way to customize this way.

    Thanks in advance!

    sushismb Friend
    #321370

    Possible? Or not?

    chanton Friend
    #328413

    Someone got the solution for JA News 1, but it did not work for JA News2.
    http://www.joomlart.com/forums/topic/ja-news-and-category-image/

    This is a very useful feature, and see anyone can help to update the changes for Ja News2.

    Saguaros Moderator
    #328521

    hello guys!

    I have the solution for u to improve this feature:

    Now, please open the file: modulesmod_janews2helper.php and try to find function named is “function loadCategories($sid) {” and find the sql query:
    [PHP]
    $query = “SELECT `id`, `title`, `description` CASE WHEN CHAR_LENGTH(`alias`) THEN CONCAT_WS(“:”, `id`, `alias`) ELSE `id` END as `slug` FROM `#__categories` s WHERE published = 1 and section=” . ( int ) $sid . $where;
    [/PHP]
    you replace this by:
    [PHP]
    $query = “SELECT `id`, `title`, `description`,image, CASE WHEN CHAR_LENGTH(`alias`) THEN CONCAT_WS(“:”, `id`, `alias`) ELSE `id` END as `slug` FROM `#__categories` s WHERE published = 1 and section=” . ( int ) $sid . $where;
    [/PHP]

    – Please open the file modulesmod_janews2tmplblog_item.php and find code:
    [PHP]
    $image = $helper->replaceImage ($row, $img_align, $autoresize, $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 ){
    $image = !$cat->category->image ? ” :'<img src=”‘.’images/stories/’. $cat->category->image.'” />’;
    $row->introtext = $image. $row->introtext;
    }
    $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));

    $image = $helper->replaceImage ($row, $img_align, $autoresize, $maxchars, $s_showimage, $img_w, $img_h, $hiddenClasses);
    [/PHP]

    Explain for codes above: The image of category will display if the article have not any image.

    chanton Friend
    #328559

    thanks so much. It should be part of the JA News2 package.

    chanton Friend
    #330046

    <em>@tienhc 159371 wrote:</em><blockquote>hello guys!

    I have the solution for u to improve this feature:

    Now, please open the file: modulesmod_janews2helper.php and try to find function named is “function loadCategories($sid) {” and find the sql query:
    [PHP]
    $query = “SELECT `id`, `title`, `description` CASE WHEN CHAR_LENGTH(`alias`) THEN CONCAT_WS(“:”, `id`, `alias`) ELSE `id` END as `slug` FROM `#__categories` s WHERE published = 1 and section=” . ( int ) $sid . $where;
    [/PHP]
    you replace this by:
    [PHP]
    $query = “SELECT `id`, `title`, `description`,image, CASE WHEN CHAR_LENGTH(`alias`) THEN CONCAT_WS(“:”, `id`, `alias`) ELSE `id` END as `slug` FROM `#__categories` s WHERE published = 1 and section=” . ( int ) $sid . $where;
    [/PHP]

    – Please open the file modulesmod_janews2tmplblog_item.php and find code:
    [PHP]
    $image = $helper->replaceImage ($row, $img_align, $autoresize, $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 ){
    $image = !$cat->category->image ? ” :'<img src=”‘.’images/stories/’. $cat->category->image.'” />’;
    $row->introtext = $image. $row->introtext;
    }
    $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));

    $image = $helper->replaceImage ($row, $img_align, $autoresize, $maxchars, $s_showimage, $img_w, $img_h, $hiddenClasses);
    [/PHP]

    Explain for codes above: The image of category will display if the article have not any image.</blockquote>

    I just found out that your solution does not work when user has logined. I tried with admin login, and category image just not shown. when log out, image shown again.

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

This topic contains 7 replies, has 3 voices, and was last updated by  chanton 14 years, 10 months ago.

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