vit

vit

С нами с 03 июня 2022; Место в рейтинге пользователей: #172
Вячеслав Варов
08 мая 2024, 13:36
1
0
server {
	server_name 213.139.209.81 www.213.139.209.81;
    return 301 https://213.139.209.81$request_uri;
	charset off;
	index index.php index.html;
	disable_symlinks if_not_owner from=$root_path;
	include /etc/nginx/vhosts-includes/*.conf;
	include /etc/nginx/vhosts-resources/213.139.209.81/*.conf;
	access_log /var/www/httpd-logs/213.139.209.81.access.log;
	error_log /var/www/httpd-logs/213.139.209.81.error.log notice;
	ssi on;
	set $root_path /var/www/www-root/data/www/213.139.209.81;
	root $root_path;
	gzip on;
	gzip_comp_level 5;
	gzip_disable "msie6";
	gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
	
	location @modx-rewrite {
        rewrite ^/(.*)$ /index.php?q=$1&$args last;
    }
	
	location / {
		try_files $uri $uri/ @modx-rewrite;
		location ~ [^/]\.ph(p\d*|tml)$ {
			try_files /does_not_exists @php;
		}
		location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf|webp|woff|woff2)$ {
			expires 24h;
		}
	}
	location @php {
		include /etc/nginx/vhosts-resources/213.139.209.81/dynamic/*.conf;
		fastcgi_index index.php;
		fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@213.139.209.81";
		fastcgi_pass unix:/var/www/php-fpm/1.sock;
		fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
		try_files $uri =404;
		include fastcgi_params;
	}
	listen 213.139.209.81:80;
}
server {
	server_name 213.139.209.81 www.213.139.209.81;
	ssl_certificate "/var/www/httpd-cert/www-root/213.139.209.81_le1.crt";
	ssl_certificate_key "/var/www/httpd-cert/www-root/213.139.209.81_le1.key";
	ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
	ssl_prefer_server_ciphers on;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
	ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
	charset off;
	index index.php index.html;
	disable_symlinks if_not_owner from=$root_path;
	include /etc/nginx/vhosts-includes/*.conf;
	include /etc/nginx/vhosts-resources/213.139.209.81/*.conf;
	access_log /var/www/httpd-logs/213.139.209.81.access.log;
	error_log /var/www/httpd-logs/213.139.209.81.error.log notice;
	ssi on;
	set $root_path /var/www/www-root/data/www/213.139.209.81;
	root $root_path;
	gzip on;
	gzip_comp_level 5;
	gzip_disable "msie6";
	gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
	
    
    location @modx-rewrite {
        rewrite ^/(.*)$ /index.php?q=$1&$args last;
    }
	
	location / {
		location ~ [^/]\.ph(p\d*|tml)$ {
			try_files /does_not_exists @php;
		}
		location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf|webp|woff|woff2)$ {
			expires 24h;
		}
		try_files $uri $uri/ @modx-rewrite;
	}
	
	location @php {
		include /etc/nginx/vhosts-resources/213.139.209.81/dynamic/*.conf;
		fastcgi_index index.php;
		fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@213.139.209.81";
		fastcgi_pass unix:/var/www/php-fpm/1.sock;
		fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
		try_files $uri =404;
		include fastcgi_params;
	}
	
	listen 213.139.209.81:443 ssl;
}
Получилось так, может кому полезно будет)
Павел Романов
04 мая 2024, 13:27
2
+3
Так вроде, пошустрее будет ):
$sql = "
    SELECT tvr.value, tv.caption
    FROM {$modx->getTableName('modTemplateVarResource')} tvr
    LEFT JOIN {$modx->getTableName('modTemplateVar')} tv
    ON tv.id = tvr.tmplvarid 
    WHERE tvr.contentid = {$id} AND tv.category = {$category}
";
$q = $modx->prepare($sql);
$q->execute();
$resources = $q->fetchAll(PDO::FETCH_ASSOC);
foreach($resources as $resource){
    $out .= $modx->getChunk($tpl, $resource);
}
return $out;

В чанке [[+caption]] и [[+value]]:
<div class="item-parent">
    <div class="row">
        <div class="col-9 pr-0">
            <span class="caption">[[+caption]]:</span>
            <div class="item-bg" data-rating="[[+value]]"></div>
        </div>
        <div class="col-3">
            <span class="rating">[[+value]]/10</span>
        </div>
    </div>
</div>

Кстати, верный ID категории можно узнать в Элементы » Категории.
vectorserver
17 ноября 2023, 20:13
1
+1
Создаешь сниппет mod_image
<?php

/* @var modX $modx*/
/* @var $input*/


// Создаем объект DOMDocument
$dom = new DOMDocument();


// Загружаем HTML-код
$html = $input;
//$dom->loadHTML($html);
$dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));


// Получаем все элементы <img>
$xpath = new DOMXPath($dom);
$images = $xpath->query("//img");

foreach ($images as $image) {
    // Получаем старый путь из атрибута 'src'
    $oldSrc = $image->getAttribute('src');
    $new_path = $modx->runSnippet('phpthumbof',['input'=>$oldSrc,'options'=>'w=0&h=800&zc=0']);
    // Заменяем значение атрибута 'src'
    $image->setAttribute('src', $new_path);


    // Получаем родительский элемент <a> и добавляем атрибут 'href' с значением $oldSrc
    $parentLink = $image->parentNode;
    if ($parentLink->nodeName === 'a') {
        $parentLink->setAttribute('href', $oldSrc);
    } else{

        // Создаем тег a
        $a = $dom->createElement('a');
        $a->setAttribute('href', $oldSrc);

        $a->setAttribute('data-fancybox', 'gal');
        $a->setAttribute('class', 'pointer img-fluid');
        $image->parentNode->replaceChild($a, $image);
        $a->appendChild($image);
    }

    if(!$image->getAttribute('title')){
        $image->setAttribute('title', 123);
        $image->setAttribute('alt', 'Рисунок');
    }

}

// Получаем обновленный HTML-код
$content_new = $dom->saveHTML();


return $content_new;
и потом используй
{$_modx->resource.content | replace : '<h3>' : '<h3 class="title-dec">' | mod_image}
Dan
Dan
22 июня 2023, 16:48
1
+1
А ссылка находится вне формы что ли? Просто если она внутри, то почему бы не сделать обычную submit-кнопку? Ну а вообще обычный код:
var form = document.getElementById('id_формы');
document.getElementById('finish').addEventListener('click', function() {
   form.submit();
});
Артур Шевченко
29 января 2023, 20:01
1
0
Ты сам решил что так можно или видел где? Если где-то увидел, больше там не смотри. Вот тебе проверенные материалы от надёжного автора.
Антон Тарасов
11 октября 2022, 18:55
1
0
Вы собрали все в переменную $name, теперь ее делаете плейсхолдером и выводите.
Антон Тарасов
11 октября 2022, 18:43
1
0
foreach ($result as $data) {
    $name .= "<input type='radio' id='fullname' name='fullname' value='$data["name"]'><label for='fullname'>$data["name"]</label>"
    }
Антон Тарасов
11 октября 2022, 18:23
1
0
Конкатенацией, например, так:
$name .= $data['name'];
или с каким-либо разделителем, как они должны в итоге выглядеть, через запятую, или каждый на новой строке?
Антон Тарасов
11 октября 2022, 18:04
1
0
переменная $name в итоге получает только значение имени последнего клиента, убедитесь, что оно непусто(ну и есть такой столбец конечно).
Сам сниппет-то вызывается(можно попробовать вызывать некешированным !snippet)? Добавьте больше отладочных сообщений.