2019-03-18, 21:07:25
Hi Rihanna, here an Example. I hope this helps:
function GetTeamNews($showallgroups=false)
{
if (return_special_field('blog')=="" && ! $showallgroups)return;
$result = return_blog_category( return_special_field('blog'));
$cnt=0;
if(count($result))
{
echo '<div class="row">';
foreach ($result as $slug => $filename )
{
if ($cnt<1 || ($showallgroups && $cnt <> 5))
{
echo "<div class='col-lg-6 col-sm-12'>";
$cnt++;
//print_r( getXML( $filename['filename']));
$post = getXML( $filename['filename']);
$title = (string) $post->title;
$author = (string) $post->author;
$date = strtotime($post->date);
$content = html_entity_decode( $post->content );
$team =$showallgroups?"$post->category: ":"";
echo "<h4>$team $title<span style='font-size:80%;'><br>vom ".date('d.m.Y', $date)."</h4>";
if ($post->thumbnail !="")
echo "<a href ='/index.php?id=news&post=$post->slug'><img src='/data/uploads/$post->thumbnail' style='float:right; padding-left:2em;padding-bottom:2em;width:50%; '/></a>";
if ($showallgroups )
{
$article = explode("</p>",$content);
echo $article[0]."</p>";
echo $article[1]."</p>";
echo "<p><a href ='/index.php?id=news&post=$post->slug'>weiterlesen ...</a></p>";
}
else
echo $content;
echo "</div>\n";
if ($cnt %2 ==0)
{
echo "</div>\n<div class='row'>\n";
}
}
}
echo '<div class="row">';
}
}
function GetTeamNews($showallgroups=false)
{
if (return_special_field('blog')=="" && ! $showallgroups)return;
$result = return_blog_category( return_special_field('blog'));
$cnt=0;
if(count($result))
{
echo '<div class="row">';
foreach ($result as $slug => $filename )
{
if ($cnt<1 || ($showallgroups && $cnt <> 5))
{
echo "<div class='col-lg-6 col-sm-12'>";
$cnt++;
//print_r( getXML( $filename['filename']));
$post = getXML( $filename['filename']);
$title = (string) $post->title;
$author = (string) $post->author;
$date = strtotime($post->date);
$content = html_entity_decode( $post->content );
$team =$showallgroups?"$post->category: ":"";
echo "<h4>$team $title<span style='font-size:80%;'><br>vom ".date('d.m.Y', $date)."</h4>";
if ($post->thumbnail !="")
echo "<a href ='/index.php?id=news&post=$post->slug'><img src='/data/uploads/$post->thumbnail' style='float:right; padding-left:2em;padding-bottom:2em;width:50%; '/></a>";
if ($showallgroups )
{
$article = explode("</p>",$content);
echo $article[0]."</p>";
echo $article[1]."</p>";
echo "<p><a href ='/index.php?id=news&post=$post->slug'>weiterlesen ...</a></p>";
}
else
echo $content;
echo "</div>\n";
if ($cnt %2 ==0)
{
echo "</div>\n<div class='row'>\n";
}
}
}
echo '<div class="row">';
}
}