首先,我对PHP非常陌生。
我正在使用Conrete5,我有一个新的模板到图像滑块。这就是我正在使用的:
http://codepen.io/altitudems/pen/KdgGLG
有一个占位符图片,我试图通过抓取块本身中的第一个图像来替换它。这是我在实际块中的视图文件:
<?php defined('C5_EXECUTE') or die("Access Denied.");
$navigationTypeText = ($navigationType == 0) ? 'arrows' : 'pages';
$c = Page::getCurrentPage();
if ($c->isEditMode()) { ?>
<div class="ccm-edit-mode-disabled-item" style="width: <?php echo $width; ?>; height: <?php echo $height; ?>">
<div style="padding: 40px 0px 40px 0px"><?php echo t('Image Slider disabled in edit mode.')?></div>
</div>
<?php } else { ?>
<script>
$(document).ready(function(){
$(function () {
$("#ccm-image-slider-<?php echo $bID ?>").responsiveSlides({
prevText: "", // String: Text for the "previous" button
nextText: "",
<?php if($navigationType == 0) { ?>
nav:true
<?php } else { ?>
pager: true
<?php } ?>
});
});
});
</script>
<div class="ccm-image-slider-container ccm-block-image-slider-<?php echo $navigationTypeText?>" >
<div class="ccm-image-slider">
<div class="ccm-image-slider-inner">
<?php if(count($rows) > 0) { ?>
<ul class="rslides" id="ccm-image-slider-<?php echo $bID ?>">
<?php foreach($rows as $row) { ?>
<li>
<?php if($row['linkURL']) { ?>
<a href="<?php echo $row['linkURL'] ?>" class="mega-link-overlay"></a>
<?php } ?>
<?php
$f = File::getByID($row['fID'])
?>
<?php if(is_object($f)) {
$tag = Core::make('html/image', array($f, false))->getTag();
if($row['title']) {
$tag->alt($row['title']);
}else{
$tag->alt("slide");
}
print $tag; ?>
<?php } ?>
<div class="ccm-image-slider-text">
<?php if($row['title']) { ?>
<h1 class="ccm-image-slider-title"><?php echo $row['title'] ?></h1>
<?php } ?>
<?php echo $row['description'] ?>
</div>
</li>
<?php } ?>
</ul>
<?php } else { ?>
<div class="ccm-image-slider-placeholder">
<p><?php echo t('No Slides Entered.'); ?></p>
</div>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
这是我的图库视图文件:
<a class="gallery-launcher" href="#gallery1"> // Location of the image
<div class="overlay">
<div class="overlay-content">
<button class="btn btn-default">Open Gallery</button>
</div>
</div>
</a>
<div class="gallery inactive" id="gallery1">
<div class="gallery-item">
//Fullscreen gallery code here
</div>
</div>
它所说的位置//图像的位置是我需要第一个图像集的位置。我无法弄清楚我放在那里的东西?任何帮助将不胜感激。
答案 0 :(得分:0)
您可以使用concrete5文件助手来获取文件路径,例如:
SessionFactory sessionFactory = new
Configuration().configure().buildSessionFactory(
new StandardServiceRegistryBuilder().applySettings(new
Configuration().configure().getProperties()).build());
一般情况下,我建议您详细了解concrete5 file functions以了解更多信息: