Skip to content

Instantly share code, notes, and snippets.

View sashabeep's full-sized avatar

Sasha Beep sashabeep

View GitHub Profile
@sashabeep
sashabeep / locales.md
Created November 1, 2024 07:47
Laravel locales Evo

htaccess

RewriteRule ^([a-z]{2})$ $1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]{2})/(.*)$ index.php?q=$2&lang=$1 [L,QSA]

Дальше файлик core/custom/config/app/locale.php

@sashabeep
sashabeep / desc.md
Created April 15, 2024 20:00
multitv crop

all you need to do is get the data and pass it to your image processor class. *file mtvCrop,js is part MultiTV and automatic load in back-end. not use in front-end. prepare multitv and config

if you have already installed and configured multitv and the necessary configuration files, then proceed to creating a snippet create tv 'goods_images', type: multitv description of the structure (can be skipped)

in back-end on page edit image (in TV goods_images). after that image`s info saved in site_tmplvar_contentvalues like this:

@sashabeep
sashabeep / showmore.js
Created November 2, 2023 07:32
Кнопка показать еще с аякс подгрузкой
if( $('.show-catalognext').length ){
/*Проверка того, что есть кнопка "вперед" в пагинаторе. В efilterresult 'TplNextP'=>'@CODE: <li class="page-item show-catalognext"><a href="[+link+]" class="page-link"> &raquo; </a></li>',*/
$('.showmore_wrapper').show(); /*показать кнопку "показать еще"*/
$('#showmore_button').on('click',function(){
if($('.show-catalognext>a').length){
var link = $('.show-catalognext>a').attr("href");
$.get( link, function (data) {
var products = $(data).find('#products_list').html();
$("#products_list").append(products); //подгрузка продуктов со следующей страницы в обертку
var pagination = $(data).find('#pagination-pager').html();
@sashabeep
sashabeep / productOptions.blade.php
Created September 19, 2023 18:13
Evo cms пример вывода свойств продукта из всех заполненных TV используя названия TV как в админке
@if(!empty($productOptions))
<ul>
@foreach ($productOptions as $item)
<li><b>{{ $item['caption'] }}:</b> {{ str_replace("||",", ",$item['value']) }}</li> {{--не помню зачем, вроде, для множественных значений--}}
@endforeach
</ul>
@endif
@sashabeep
sashabeep / jquery.plugin.txt
Created September 19, 2023 10:06
Masked input Evolution CMS
download https://raw.githubusercontent.com/digitalBush/jquery.maskedinput/master/dist/jquery.maskedinput.js
@sashabeep
sashabeep / mainmenu.blade.php
Created August 14, 2023 11:57
evolution cms basic bootstrap menu
{!! $modx->runSnippet('DLMenu',[
'parents' => 0,
'maxDepth' => 2,
'outerClass'=> 'navbar-nav mainmenu',
'rowClass'=>'nav-item',
'currentClass'=>'active',
'hereClass'=>'active',
'rowTpl'=>'@CODE: <li [+classes+]><a class="nav-link" href="[+url+]" [+link_attributes+]>[+title+]</a></li>',
'parentRowTpl'=>'@CODE: <li [+classes+]> <a class="nav-link dropdown-toggle" href="[+url+]" [+link_attributes+] data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">[+title+]</a>[+wrap+]</li>',
'innerClass'=>'dropdown-menu',
@sashabeep
sashabeep / fix.php
Created July 28, 2023 09:14
formresult double quotes
array_walk($data, function(&$v, $k) {
if(is_string($v) && strpos($v, '"') !== false) {
$v = str_replace('"', '\"', $v);
}
});
@sashabeep
sashabeep / list.snippet.php
Last active June 30, 2023 12:18
List template variable modx evo
<?php
/*usage: [[ list? &tvname=`param` &class=`myclass` &name=`myname` &docid=`N` ]] */
$doc = isset($docid) ? $docid : $modx->documentIdentifier;
$class = isset($class) ? $class : "";
$name = isset($name) ? $name : "";
$input = $modx->getTemplateVar($tvname,'*',$doc)['value'];
$vals = explode("||",$input);
@sashabeep
sashabeep / rss_page.html
Last active June 16, 2023 12:56
Turbo RSS doclister Evolution CMS
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:yandex="http://news.yandex.ru"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:turbo="http://turbo.yandex.ru"
version="2.0">
<channel>
<title>[(site_name)]</title>
<link>[(site_url)]</link>
<description>[*description*]</description>
[[DocLister? &parents=`10` &format=`rss` &tpl=`rss_tpl` &depth=`3` &prepare=`rss_prepare` &display=`50` &dateFormat='%s' ]]
@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,