Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
concrete5 RSS表示のカスタマイズ
.ccm-block-rss-displayer-item {
margin-bottom: 16px;
}
.rssItemThumbnail img {
max-width: 125px;
height: auto;
border-radius: 20px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
}
.left { float: left;margin-right:10px; }
.clear { clear: both; }
.ccm-block-rss-displayer-item-title {
font-weight: bold;
}
.ccm-block-rss-displayer-item-title a::before {
font-family: "FontAwesome";
content: "\f138 ";
}
.ccm-block-rss-displayer-item-date {
color: #999;
}
<?php defined('C5_EXECUTE') or die("Access Denied."); ?>
<div class="ccm-block-rss-displayer-wrapper">
<div class="ccm-block-rss-displayer">
<?php if (strlen($title) > 0) {
?>
<div class="ccm-block-rss-displayer-header">
<h5><?php echo $title?></h5>
</div>
<?php
} ?>
<?php
$rssObj = $controller;
$textHelper = Loader::helper("text");
if (isset($errorMsg) && strlen($errorMsg) > 0) {
echo $errorMsg;
} else {
foreach ($posts as $itemNumber => $item) {
if (intval($itemNumber) >= intval($rssObj->itemsToDisplay)) {
break;
}
?>
<div class="ccm-block-rss-displayer-item">
<div class="rssItemThumbnail">
<?php
if (!function_exists('get_first_image_url'))
{
function get_first_image_url($html)
{
{
if (preg_match('/<img.+?src="(.+?)"/', $html, $matches))
{
return $matches[1];
}
else echo '';
}
}
}
echo '<img src="' .get_first_image_url($item->getContent()). '" class="left" />';
?>
</div>
<div class="ccm-block-rss-displayer-item-title">
<a href="<?php echo $item->getLink();
?>" <?php if ($rssObj->launchInNewWindow) {
echo 'target="_blank"';
}
?> >
<?php echo $item->getTitle();
?>
</a>
</div>
<div class="ccm-block-rss-displayer-item-date"><?php echo h($this->controller->formatDateTime($item->getDateCreated()));
?></div>
<div class="ccm-block-rss-displayer-item-summary">
<?php
if ($rssObj->showSummary) {
echo $textHelper->shortText(strip_tags($item->getDescription()));
}
?>
</div>
<br class="clear">
</div>
<?php
}
}
?>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.