Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newsfeed intro image [redo] #11687

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions components/com_content/views/category/view.feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,19 @@ class ContentViewCategory extends JViewCategoryfeed
*/
protected function reconcileNames($item)
{
// Get description, author and date
// Get description, intro_image, author and date
$app = JFactory::getApplication();
$params = $app->getParams();
$item->description = $params->get('feed_summary', 0) ? $item->introtext . $item->fulltext : $item->introtext;
$item->description = '';
$obj = json_decode($item->images);
$introImage = ( isset( $obj->{'image_intro'} ) ) ? $obj->{'image_intro'} : '';

if (isset($introImage) && ($introImage != ""))
{
$image = preg_match('/http/', $introImage)? $introImage : JURI::root() . $introImage;
$item->description = '<p><img src="' . $image . '" /></p>';
}
$item->description .= ($params->get('feed_summary', 0) ? $item->introtext . $item->fulltext : $item->introtext);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still need a new line after the closing if braces :-) (in view.feed.php too)


// Add readmore link to description if introtext is shown, show_readmore is true and fulltext exists
if (!$item->params->get('feed_summary', 0) && $item->params->get('feed_show_readmore', 0) && $item->fulltext)
Expand Down
11 changes: 10 additions & 1 deletion components/com_content/views/featured/view.feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,16 @@ public function display($tpl = null)
$db->setQuery($query);
$row->fulltext = $db->loadResult();

$description = ($params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext);
$description = '';
$obj = json_decode($row->images);
$introImage = ( isset( $obj->{'image_intro'} ) ) ? $obj->{'image_intro'} : '';

if (isset($introImage) && ($introImage != ""))
{
$image = preg_match('/http/', $introImage)? $introImage : JURI::root() . $introImage;
$description = '<p><img src="' . $image . '" /></p>';
}
$description .= ($params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext);
$author = $row->created_by_alias ? $row->created_by_alias : $row->author;

// Load individual item creator class
Expand Down