Skip to content

Instantly share code, notes, and snippets.

@cukabeka
Created September 30, 2016 13:41
Show Gist options
  • Save cukabeka/23a74273d4e7b0973164bbc12b5141c7 to your computer and use it in GitHub Desktop.
Save cukabeka/23a74273d4e7b0973164bbc12b5141c7 to your computer and use it in GitHub Desktop.
redaxo YFeed output - thx Alex Walther
<section class="modul modul-yfeed" id="modul-REX_SLICE_ID">
<div class="wrapper">
<h2>###modul:yfeed:title###</h2>
<div class="modul-yfeed-twitter">
<h3>Twitter</h3>
<?php
$yfeed_items = rex_sql::factory()->getArray('SELECT * FROM rex_yfeed_item WHERE stream_id = 2 ORDER BY date DESC LIMIT 3');
if (count($yfeed_items)) {
echo '<table>';
foreach ($yfeed_items as $item) {
$item_date = strftime("%d. %B %Y", strtotime($item['date']));
echo '<tr>';
echo '<td class="yfeed-title"><p class="item-date"><strong><b>'.$item_date.'</b></strong></p>';
echo nl2br($item['content']).'</td>';
echo '</tr>';
}
echo '</table>';
}
?>
</div>
<div class="modul-yfeed-twitter">
<h3>Facebook</h3>
<?php
$yfeed_items = rex_sql::factory()->getArray('SELECT * FROM rex_yfeed_item WHERE stream_id = 1 ORDER BY date DESC LIMIT 3');
if (count($yfeed_items)) {
echo '<table>';
foreach ($yfeed_items as $item) {
$item_date = strftime("%d. %B %Y", strtotime($item['date']));
echo '<tr>';
echo '<td class="yfeed-media"><img src="'.$item['media'].'" alt="" style="max-width: 200px;" /></td>';
echo '<td class="yfeed-title"><p class="item-date"><strong><b>'.$item_date.'</b></strong></p>
<a href="'.$item['url'].'" target="_blank"><h2>'.$item['title'].'</h2></a><br />';
echo ''.nl2br($item['content']).'</td>';
echo '</tr>';
}
echo '</table>';
}
?>
</div>
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment