{source}
<?php
// Get the ID of the category you want to display
$category_id = 1;
// Get the articles from the category
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('id', 'title', 'introtext')))
->from($db->quoteName('#__content'))
->where($db->quoteName('catid') . ' = ' . (int) $category_id);
$db->setQuery($query);
$articles = $db->loadObjectList();
?>
<style>
.ticker {
width: 100%;
overflow: hidden;
position: relative;
}
.ticker ul {
display: flex;
position: absolute;
white-space: nowrap;
animation: ticker 10s linear infinite;
}
.ticker li {
display: inline-block;
padding: 0 20px;
min-width: 500px;
}
@keyframes ticker {
0% {
transform: translate3d(0, 0, 0);
}
100% {
transform: translate3d(-100%, 0, 0);
}
}
</style>
<div class="ticker">
<ul>
{source}
<?php
// Output the articles
foreach ($articles as $article) {
echo '<li>' . $article->introtext . '</li>';
}
?>
{/source}
</ul>
</div>
{/source}
{source}
...
<div class="ticker">
<ul>
{source}
...
{/source}
</ul>
</div>
{/source}