contao/import — Issue #3024: Alternative method to render Article-linked content in News
Author: importer
Created: 2011-11-29 20:43:41+00:00
State: open
Labels: Accepted, Feature, news

I prefer this method to link Articles into a blog/news element. It's much cleaner and it means you can still wrap the content within the News settings, like Image, date, tags, etc. or other integrations.

It could be implemented as a new checkbox:

News Entry ```>

Source
(*) Article

[ Article ID:32 ]

[x] Embed Article inside News Reader (NEW) [field:blnEmbed, checkbox]

To implement ```

ModuleNews.php ```
add a check in the article link generator to bypass if the above is checked (so it doesn't render an articles url, but a normal news url, e.g. /items/newsitem.html
the case 'articles' in the generateNewsUrl()

```
// Link to an article
case 'article':
if (

![]($objArticles->blnEmbed)
{
$objPage = $this->Database->prepare("SELECT a.id AS aId, a.alias AS aAlias, a.title, p.id, p.alias FROM tl_article a, tl_page p WHERE a.pid=p.id AND a.id=?")
->limit(1)
->execute($objArticle->articleId);

if ($objPage->numRows)
{
self::$arrUrlCache[$strCacheKey] = ampersand($this->generateFrontendUrl($objPage->row(), '/articles/' . (()$GLOBALS['TL_CONFIG']['disableAlias'] && strlen($objPage->aAlias)) ? $objPage->aAlias : $objPage->aId)));
}
break;
}

```

Then in parse Articles:

Split the article part out into a content rendering call

current```

```
// Display the "read more" button for external/article links
if (($objArticles->source == 'external' || $objArticles->source == 'article') &&

![](strlen($objArticles->text))
{
$objTemplate->text = true;
}

```

updated ```

```
// Display the "read more" button for external links
if (($objArticles->source == 'external' || ($objArticles->source == 'article' && )$objArticles->blnEmbed)) && !strlen($objArticles->text))
{
$objTemplate->text = true;
}

// Override text with Article content
if ($objArticles->source == 'article' && $objArticles->blnEmbed)
{
$objTemplate->text = $this->getArticle($objArticles->articleId, false, true);
}

```

--- _Originally created by thyon on April 22nd, 2011, at 01:28pm (ID 3024)_