-
AuthorPosts
-
sushismb Friend
sushismb
- Join date:
- October 2008
- Posts:
- 370
- Downloads:
- 59
- Uploads:
- 24
- Thanks:
- 86
- Thanked:
- 8 times in 1 posts
October 14, 2009 at 8:35 am #145183Hello,
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 Friendsushismb
- Join date:
- October 2008
- Posts:
- 370
- Downloads:
- 59
- Uploads:
- 24
- Thanks:
- 86
- Thanked:
- 8 times in 1 posts
October 15, 2009 at 3:55 am #320540I’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 Friendsushismb
- Join date:
- October 2008
- Posts:
- 370
- Downloads:
- 59
- Uploads:
- 24
- Thanks:
- 86
- Thanked:
- 8 times in 1 posts
October 23, 2009 at 3:22 pm #321370Possible? Or not?
chanton Friendchanton
- Join date:
- July 2006
- Posts:
- 137
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 6
- Thanked:
- 2 times in 1 posts
January 6, 2010 at 9:17 am #328413Someone 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 ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
January 7, 2010 at 7:48 am #328521hello 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.
1 user says Thank You to Saguaros for this useful post
chanton Friendchanton
- Join date:
- July 2006
- Posts:
- 137
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 6
- Thanked:
- 2 times in 1 posts
January 7, 2010 at 11:23 am #328559thanks so much. It should be part of the JA News2 package.
chanton Friendchanton
- Join date:
- July 2006
- Posts:
- 137
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 6
- Thanked:
- 2 times in 1 posts
January 22, 2010 at 1:14 pm #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.
-
AuthorPosts
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