[2021-07-18 16:26:58] (ERROR @ /home/cmtaru/public_html/core/cache/includes/elements/modsnippet/53.include.cache.php : 5) PHP warning: opendir(prices): failed to open dir: No such file or directory
[2021-07-18 16:26:58] (ERROR @ /home/cmtaru/public_html/core/cache/includes/elements/modsnippet/53.include.cache.php : 20) PHP warning: implode(): Invalid arguments passed
$fields = $hook->getValues();
$dir = 'prices';
if ( $handle = opendir( $dir ) )
{
while ( $file = readdir($handle) )
{
for ($i=0; $i<count($file); $i++)
if(($file != '.') && ($file != '..') && ($file[0] != '.')) {
$file = mb_convert_encoding($file, "utf-8", "windows-1251");
$file = '<br /><a href="https://.../prices/'.$file.'">'.$file.'</a>';
$fileOrder[] = $file;
}
};
closedir( $handle );
};
// $hook->setValue('fileOrder', $fileOrder);
$fields['fileOrder'] = $fileOrder;
$message = $modx->getChunk('tpl.mail.price', $fields);
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY, $message);
$modx->mail->set(modMail::MAIL_FROM, $modx->getOption('emailsender'));
$modx->mail->set(modMail::MAIL_FROM_NAME, $modx->getOption('site_name'));
$modx->mail->set(modMail::MAIL_SUBJECT, 'Прайс-лист');
$modx->mail->address('to', $fields['email']);
$modx->mail->address('reply-to', $modx->getOption('emailsender'));
$modx->mail->setHTML(true);
if (!$modx->mail->send()) {
$modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$modx->mail->mailer->ErrorInfo);
}
$modx->mail->reset();
return true;
<?php
$fields = $hook->getValues();
$dir = 'prices';
if ( $handle = opendir( $dir ) )
{
while ( $file = readdir($handle) )
{
for ($i=0; $i<count($file); $i++)
if(($file != '.') && ($file != '..') && ($file[0] != '.')) {
$file = mb_convert_encoding($file, "utf-8", "windows-1251");
$file = '<br /><a href="https://.../prices/'.$file.'">'.$file.'</a>';
$fileOrder[] = $file;
}
};
closedir( $handle );
};
$hook->setValue('fileOrder', $fileOrder);
$message = $modx->getChunk('tpl.mail.price', $fields);
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY, $message);
$modx->mail->set(modMail::MAIL_FROM, $modx->getOption('emailsender'));
$modx->mail->set(modMail::MAIL_FROM_NAME, $modx->getOption('site_name'));
$modx->mail->set(modMail::MAIL_SUBJECT, 'Прайс-лист');
$modx->mail->address('to', $fields['email']);
$modx->mail->address('reply-to', $modx->getOption('emailsender'));
$modx->mail->setHTML(true);
if (!$modx->mail->send()) {
$modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$modx->mail->mailer->ErrorInfo);
}
$modx->mail->reset();
return true;
var galleryThumbs = new Swiper('.gallery-thumbs', {
spaceBetween: 10,
slidesPerView: 4,
freeMode: true,
watchSlidesVisibility: true,
watchSlidesProgress: true,
});
var galleryTop = new Swiper('.gallery-top', {
pagination: {
el: '.top-pagination',
type: 'fraction',
},
spaceBetween: 10,
navigation: {
nextEl: '.swiper-button-next-top',
prevEl: '.swiper-button-prev-top',
},
thumbs: {
swiper: galleryThumbs
}
});
galleryTop.on('init', function () {
if (window.location.hash) {
const hash = window.location.hash
const slideIndex = parseInt(hash.replace('#slide', ''), 10)
galleryTop.slideTo(slideIndex) // либо slideToLoop, если у вас включен loop
}
});
galleryTop.on('slideChange', function () {
window.location.hash = `#slide${galleryTop.activeIndex}` // либо realIndex, если включен loop
});
Если нужны ссылки не с номерами слайдов, а с какими-то текстовыми идентификаторами, сделайте с ними массив и по нему находите нужный индекс слайда в свайпере, делов-то.
Варианта два, либо использование библиотек, либо можете написать сами с нуля.