I have a PHP code that takes content from a feed, I would like to separate this content into two divs. For example: div1 will be the first five posts in a carousel (jcarousel) and in div2 there will be another five posts in a listing.
<?php
// loalidade BR e idioma pt_BR
setlocale(LC_ALL, "pt_BR", "pt_BR.iso-8859-1", "pt_BR.utf-8", "portuguese") or die('Locale not installed');
date_default_timezone_set('America/Sao_Paulo');
$rss = new DOMDocument();
$rss->load('https://jovemnerd.com.br/nerdnews/feed/');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
);
array_push($feed, $item);
}
<div class='box'>
$limit = 5;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' & ', $feed[$x]['title']);
$link = $feed[$x]['link'];
$description = $feed[$x]['desc'];
// aqui foi alterado para a função com a formatação correta
$date = strftime("%A, %d de %B de %Y", strtotime($feed[$x]['date']));
echo '<p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong><br />';
echo '<small><em>'.$date.'</em></small></p>';
echo '<p>'.$description.'</p>';
}?>
This is the code that I get the contents of RSS, but I have no idea how to separate it.