Created
September 17, 2017 12:28
-
-
Save nyankichi-n-n/e2a5669d19cfae282b8d41e7eaa825ea to your computer and use it in GitHub Desktop.
concrete5 RSS表示のカスタマイズ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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