-
AuthorPosts
-
ericl1 Friend
ericl1
- Join date:
- April 2012
- Posts:
- 21
- Downloads:
- 0
- Uploads:
- 7
- Thanks:
- 2
- Thanked:
- 1 times in 1 posts
October 21, 2012 at 7:32 am #181575Hi
Please help with the JA News Featured, I have two (2) images in the same article. The first image is placed after the Read more, and the Second image is after the Read more. The first image is the primary photo and should appear in the Ja News Featured Module at the front-end
And when i click the “Save” button and make it “Featured, the second image which is after the Read more is the one whose appearing in the front-end instead of the first image which is placed before the Read more.
JA News Featured: version 2.5.1
I really don’t know how to do it,
If ever one of the Developers of JA is right there, Please help meManos ModeratorManos
- Join date:
- February 2014
- Posts:
- 2806
- Downloads:
- 46
- Uploads:
- 56
- Thanks:
- 200
- Thanked:
- 633 times in 576 posts
October 21, 2012 at 10:15 am #470630Hi,
I tried to see the problem and help you but i couldn’t identify the problem, is this solved or is there a way i can see the problem?
Regards
ericl1 Friendericl1
- Join date:
- April 2012
- Posts:
- 21
- Downloads:
- 0
- Uploads:
- 7
- Thanks:
- 2
- Thanked:
- 1 times in 1 posts
October 21, 2012 at 11:05 am #470634Thank you for your immediate reply.
Here is the sample article, as you can see at the top left(First image) of the article that is the image i really wanted to appear at the front-end of my website. And the Second image is also related to an article.
After clicking the “Save” button so that it will appear on my front end and my visitors will be able to read the newly article, Here is the output when you View your front-end
As you can see the Second image is the one who appear on the front-end
Please help me regarding this
-
Stork11 Friend
Stork11
- Join date:
- March 2011
- Posts:
- 2273
- Downloads:
- 0
- Uploads:
- 142
- Thanks:
- 55
- Thanked:
- 431 times in 393 posts
October 24, 2012 at 10:08 am #470980<em>@ericl1 343067 wrote:</em><blockquote>Thank you for your immediate reply.
Here is the sample article, as you can see at the top left(First image) of the article that is the image i really wanted to appear at the front-end of my website. And the Second image is also related to an article.
After clicking the “Save” button so that it will appear on my front end and my visitors will be able to read the newly article, Here is the output when you View your front-end
As you can see the Second image is the one who appear on the front-end
Please help me regarding this</blockquote>
Hello ericl1,I have checked and could not see any issue as reported.
BTW, please try to check “Images and links” setting of Article settings.
Regards.
dieudonne Frienddieudonne
- Join date:
- January 2011
- Posts:
- 947
- Downloads:
- 61
- Uploads:
- 266
- Thanks:
- 452
- Thanked:
- 107 times in 3 posts
February 21, 2013 at 10:18 am #484149Hello,
we have the same problem on the right.
Like Ericl1, we have 2 images, and sometime, this is the second image who appears on this module.
How can we fix this ?
Thank in advance
We use Joomla 2.5 and all plugins, modules, …are up to date.-
dieudonne Friend
dieudonne
- Join date:
- January 2011
- Posts:
- 947
- Downloads:
- 61
- Uploads:
- 266
- Thanks:
- 452
- Thanked:
- 107 times in 3 posts
February 25, 2013 at 10:36 pm #484498Stork11 FriendStork11
- Join date:
- March 2011
- Posts:
- 2273
- Downloads:
- 0
- Uploads:
- 142
- Thanks:
- 55
- Thanked:
- 431 times in 393 posts
February 26, 2013 at 2:08 am #484510Hello dieudonne,
Please PM me (or update in your ticket) with your site information (your site URL, your site admin account) and your FTP account So I can diagnose this problem. Because I tested many times on my local but no problem faced.
Regards.
Stork11 FriendStork11
- Join date:
- March 2011
- Posts:
- 2273
- Downloads:
- 0
- Uploads:
- 142
- Thanks:
- 55
- Thanked:
- 431 times in 393 posts
Stork11 FriendStork11
- Join date:
- March 2011
- Posts:
- 2273
- Downloads:
- 0
- Uploads:
- 142
- Thanks:
- 55
- Thanked:
- 431 times in 393 posts
February 27, 2013 at 2:01 am #484655Hello all,
Problem occurred because image in full text was parsed first. So I moved “$text .= (isset($row->introtext))?$row->introtext:”;” line to below “$text .= (isset($row->fulltext))?$row->fulltext:”;” line. Image in intro text must be parsed first.
Make the same change for JA News Pro and JA News Featured as well.
Regards.
1 user says Thank You to Stork11 for this useful post
dieudonne Frienddieudonne
- Join date:
- January 2011
- Posts:
- 947
- Downloads:
- 61
- Uploads:
- 266
- Thanks:
- 452
- Thanked:
- 107 times in 3 posts
March 3, 2013 at 1:46 pm #485158Thank you very much for this.
dpchap015 Frienddpchap015
- Join date:
- September 2011
- Posts:
- 300
- Downloads:
- 75
- Uploads:
- 57
- Thanks:
- 1
- Thanked:
- 24 times in 1 posts
August 23, 2013 at 1:29 pm #503295@stork11
<em>@Stork11 361955 wrote:</em><blockquote>Hello all,Problem occurred because image in full text was parsed first. So I moved “$text .= (isset($row->introtext))?$row->introtext:”;” line to below “$text .= (isset($row->fulltext))?$row->fulltext:”;” line. Image in intro text must be parsed first.
Make the same change for JA News Pro and JA News Featured as well.
Regards.</blockquote>
Original Code:
[PHP]
$regex = ‘/<img.+srcs*=s*”([^”]*)”[^>]*>/’;
$text = ”;
$text .= (isset($row->fulltext))?$row->fulltext:”;
$text .= (isset($row->introtext))?$row->introtext:”;
preg_match($regex, $text, $matches);
$images = (count($matches)) ? $matches : array();
$image = count($images) > 1 ? $images[1] : ”;
[/PHP]I interchanged the lines = > $text .= (isset($row->fulltext))?$row->fulltext:”; & $text .= (isset($row->introtext))?$row->introtext:”;
This is how my code looks like now:
[PHP] function parseImage($row)
{
//check to see if there is an intro image or fulltext image first
$images = “”;
if (isset($row->images)) {
$images = json_decode($row->images);
}
if((isset($images->image_fulltext) and !empty($images->image_fulltext)) || (isset($images->image_intro) and !empty($images->image_intro))){
$image = (isset($images->image_intro) and !empty($images->image_intro))?$images->image_intro:((isset($images->image_fulltext) and !empty($images->image_fulltext))?$images->image_fulltext:””);
}
else {
$regex = ‘/<img.+srcs*=s*”([^”]*)”[^>]*>/’;
$text = ”;
$text .= (isset($row->introtext))?$row->introtext:”;
$text .= (isset($row->fulltext))?$row->fulltext:”;
preg_match($regex, $text, $matches);
$images = (count($matches)) ? $matches : array();
$image = count($images) > 1 ? $images[1] : ”;
}
return $image;
}
}
}[/PHP]I don’t fix my issue, Still the system picks 2nd image of the article to show in the JA News Featured Module.
I feel there is some problem with the code:
[PHP]if((isset($images->image_fulltext) and !empty($images->image_fulltext)) || (isset($images->image_intro) and !empty($images->image_intro))){
$image = (isset($images->image_intro) and !empty($images->image_intro))?$images->image_intro:((isset($images->image_fulltext) and !empty($images->image_fulltext))?$images->image_fulltext:””);
}[/PHP]Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
August 23, 2013 at 3:45 pm #503301This way will help you to get only image in introtext
function parseImage($row)
{
//check to see if there is an intro image or fulltext image first
$images = "";
if (isset($row->images)) {
$images = json_decode($row->images);
}
if((isset($images->image_intro) and !empty($images->image_intro)){
$image = (isset($images->image_intro) and !empty($images->image_intro))?$images->image_intro:"";
}
else {
$regex = '/<img.+srcs*=s*"([^"]*)"[^>]*>/';
$text = '';
$text .= (isset($row->introtext))?$row->introtext:'';
preg_match($regex, $text, $matches);
$images = (count($matches)) ? $matches : array();
$image = count($images) > 1 ? $images[1] : '';
}
return $image;
}
But you also need to change all jaimage.php files in JA Newsfeatured, JA Newspro, JA Sidenews, JA Contentslider, JA Bulletin module. Because JAImage class in jaimage.php file of all these modules is loaded once only.
Remember to clear cache from Admin area.
dpchap015 Frienddpchap015
- Join date:
- September 2011
- Posts:
- 300
- Downloads:
- 75
- Uploads:
- 57
- Thanks:
- 1
- Thanked:
- 24 times in 1 posts
August 23, 2013 at 5:40 pm #503316@ninja Lead
I am unable to understand as to why i am getting this error : Parse error: syntax error, unexpected ‘{‘ in /home/eduvativ/public_html/test/etr_test_2/modules/mod_janews_featured/helpers/jaimage.php on line 399
on copying your code to the file. I have just replaced the code.dpchap015 Frienddpchap015
- Join date:
- September 2011
- Posts:
- 300
- Downloads:
- 75
- Uploads:
- 57
- Thanks:
- 1
- Thanked:
- 24 times in 1 posts
August 23, 2013 at 5:56 pm #503317I think i found the problem. An extra ‘(‘ in if((isset($images->image_intro) and !empty($images->image_intro)).
I guess its working now. Will update after testing it properly. 😉
1 user says Thank You to dpchap015 for this useful post
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
August 24, 2013 at 5:04 pm #503349That’s great, excellent
AuthorPostsThis topic contains 19 replies, has 8 voices, and was last updated by Ninja Lead 10 years, 2 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
Jump to forum