#javascript #php #jquery #glob #galleria
#javascript #php #jquery #глобус #галерея
Вопрос:
Я пытаюсь создать слайд-шоу (с Galleria) с наложением или «html layer», чтобы текст отображался поверх изображений. Но у меня есть множество страниц, на которых он будет загружен, поэтому он должен быть динамическим (вы так это называете?), текст наложения должен меняться в зависимости от папки, из которой будет загружен galleria.
этот код у меня есть, и он отлично работает для «динамической» загрузки изображений в зависимости от папки.
<div class="galleria">
<?php
//path to directory to scan
$directory = "./";
//get all image files with a .jpg extension.
$images = glob($directory . "*.jpg");
//print each file name
foreach($images as $image) {
echo "<img src="$image">";
}
?>
</div>
<script>
Galleria.loadTheme('/galleria/themes/classic/galleria.classic.min.js');
Galleria.configure({
showCounter: false,
})
Galleria.run('.galleria');
</script>
Я думаю, что galleria-data может быть решением, но не могу заставить его работать..
<div class="galleria">
<?php
//path to directory to scan
$directory = "./";
//get all image files with a .jpg extension.
$images = glob($directory . "*.jpg");
//path to index file with needed text
$meas = glob($directory . "*.php");
//print each file name
foreach($images as $image) {
echo "<img src="$image"";
echo " data-layer="$meas">"; //only see "Array" written over the image
}
?>
</div>
<script>
Galleria.loadTheme('/galleria/themes/classic/galleria.classic.min.js');
Galleria.configure({
showCounter: false,
})
Galleria.run('.galleria');
</script>
Надеюсь, кто-нибудь сможет мне помочь, при необходимости я могу предоставить больше информации.
Заранее спасибо!!
С уважением, Стивен
Ответ №1:
echo " data-layer="$meas">"; //only see "Array" written over the image
Попробуйте это:
echo " data-layer=".$meas.">"; //only see "Array" written over the image
HTH,
TD