Skip to content

Instantly share code, notes, and snippets.

View sashabeep's full-sized avatar

Sasha Beep sashabeep

View GitHub Profile
@sashabeep
sashabeep / ym.blade.php
Created May 25, 2023 10:46
YM + client settings
<!-- Yandex.Metrika counter -->
<script type="text/javascript" >
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
ym({{ $modx->getConfig('client_ymid') }}, "init", {
id:{{ $modx->getConfig('client_ymid') }},
clickmap:true,
trackLinks:true,
accurateTrackBounce:true,
@sashabeep
sashabeep / Formlister call
Created May 25, 2023 08:00
Formlister + ajax modal bootstrap
[!formFake!][!FormLister?
&formTpl=`@CODE:
<h3>[*pagetitle*]</h3>
<p>[*introtext*]</p>
<form action="[~[*id*]~]" method="post" id="ajaxform" class="ajaxmodal-form">
<div>[+form.messages+]</div>
<label class="d-block form-group">
Ваше имя* :
<input type="text" class="form-control [+name.errorClass+]" id="name" name="name" placeholder="Как к вам обращаться" value="[+name.value+]" required>
[+name.error+]
@sashabeep
sashabeep / test.php
Created February 15, 2023 16:33
Evo 2.0 api test
<?php
define('MODX_API_MODE', true);
define('MODX_BASE_PATH', __DIR__."/");
define('MODX_BASE_URL', '/');
define('MODX_SITE_URL', 'http://sitename.tld/');
include_once(MODX_BASE_PATH."index.php");
$modx->db->connect();
if (empty ($modx->config)) {
@sashabeep
sashabeep / controller.php
Created October 19, 2022 10:57
Вывод произвольных TV параметров с подписями
<php
//получает TV текущего документа с сортировкой по категории
$val = $modx->getTemplateVars('*', '*', $documentObject['id'],1,'category');
$tvcategories = Array(10); //ID категории TV параметров товара
$tvexclude = Array(16,17,43,45); //ID TV которые нужно исключить
//тут всё и так понятно
$productOptions = Array();
if(is_array($val) && !empty($val)){
<?php
/*
Устанавливает плейсхолдеры заголовков TV параметров документа. Полезно при выводе списка параметров товара
Вызвать в любом месте шаблона [!tvnames!]. Ничего не выводит.
Затем по всему документу можно использовать плейсхолдеры типа [+tv.name+]
//если TV "Длина" заполнено - то вывести в виде "заголовок : значение"
[[if? &is=`[*dlina*]:not:` &then=`[+dlina.name+] : [*dlina*]`]]
*/
language: 'ru',
'menubar': false,
toolbar: [
'undo redo | cut copy paste | searchreplace | bold italic underline strikethrough forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent blockquote',
'link unlink anchor image media codesample table | hr removeformat | subscript superscript charmap | nonbreaking | visualchars visualblocks print preview fullscreen code formatselect',
],
plugins: [ 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'print', 'preview', 'hr', 'anchor', 'pagebreak', 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'spellchecker', 'insertdatetime', 'media', 'nonbreaking', 'save', 'table', 'contextmenu', 'directionality', 'emoticons', 'template', 'paste', 'textcolor', 'codesample', 'colorpicker', 'textpattern', 'imagetools', 'paste', 'modxlink', 'youtube', 'textcolor' ]
@sashabeep
sashabeep / tagsaver.plugin.php
Last active February 14, 2025 12:03 — forked from AgelxNash/tagsaver.plugin.php
[Evo] Дублирование тегов в другую таблицу для удобной фильтрации без WHERE X LIKE '%tag%'. Подробности тут https://community.evocms.ru/blog/addons/4286-plugin-tagsaver-dlya-raboty-s-tegami.html
//<?php
/**
* TagSaver
*
* @category plugin,DocLister
* @version 0.2
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @internal @properties &tv=ID TV-параметра;input; &sep=Разделитель тегов;input;
* @internal @events OnDocFormSave
* @internal @modx_category Manager and Admin
@sashabeep
sashabeep / phpthumb.md
Created February 1, 2022 07:48
Phpthumb simpla

1 залить phpthumb с гитхаба в корень /phpthumb, не забыть создать папку cache внутри с 777 и задать стойкий пароль $PHPTHUMB_CONFIG['high_security_password']

2 Добавить функцию в Smarty/libs/plugins/function.phpthumb.php:

<?php

/**
 * Smarty plugin
 * @package Smarty
@sashabeep
sashabeep / blade-vscode.md
Last active January 19, 2022 12:24
Use BLADE engine for static html templates in VSCode
@sashabeep
sashabeep / gist:6a1cd36be0ef94d655aaec302b942667
Last active January 3, 2022 12:49
Проблемы с пользователями в Evo 3.x