Skip to content

Instantly share code, notes, and snippets.

@Sentinel-7
Sentinel-7 / MIGX fenom
Last active July 14, 2021 13:25
MIGX fenom
если у сниппета getImageList указывается id ресурса родителя &docid=`20`
{set $rows = 20 | resource : 'configurator' | fromJSON}
{foreach $rows as $row}
<h2>Конфигуратор</h2>
<h3>{$row.title}</h3>
<p>{$row.introtext}</p>
</div>
<div class="tm-firmware-panel-buttons">
<a href="{$row.zip}" class="uk-button uk-button-primary tm-icon-zip"></a>
@Sentinel-7
Sentinel-7 / чанк tpl.msGallery.dtls
Created August 2, 2017 14:43
Скрываем превью в msGallery
{if $files|count != '1'}
{foreach $files as $file}
<li data-uk-slideshow-item="{$file['rank']}"><a href="#" style="background-image: url({$file['small']});"><!-- <img src="{$file['small']}"> --></a></li>
{/foreach}
{/if}
@Sentinel-7
Sentinel-7 / contact.tpl
Last active August 16, 2017 06:11
MapsTv 3 google maps on 1 page marker + API system key
<div class="uk-grid" data-uk-grid-margin>
<div class="uk-width-1-2 uk-row-first">
{$_modx->resource.ad}
</div>
<div class="uk-width-1-2">
<div class="google-map-container">
<div id="propertyMap" class="propertyMap" language="ru" data-latitude="[[*coords:JSONtoChunk=`map_latitude`]]" data-longitude="[[*coords:JSONtoChunk=`map_longitude`]]"></div>
</div>
</div>
</div>
@Sentinel-7
Sentinel-7 / Sendex snippet
Last active August 17, 2017 13:15
modal uikit onload
{'!Sendex' | snippet : [
'id' => '1'
'tplActivate' => 'tpl.Sendex.activate'
]}
@Sentinel-7
Sentinel-7 / head.chunk.php
Created August 21, 2017 07:36
Чанк head
<title itemprop="name">
{if $_modx->resource.seotitle == ''}
{$_modx->resource.pagetitle}{if $_modx->config.name_title == 1}{$_modx->config.separator_title}{$_modx->config.site_name}{/if}
{else}
{$_modx->resource.seotitle}{if $_modx->config.name_title == 1}{$_modx->config.separator_title}{$_modx->config.site_name}{/if}
{/if}
</title>
{if $_modx->resource.seokeywords != ''}<meta name="keywords" content="{$_modx->resource.seokeywords}">{/if}
@Sentinel-7
Sentinel-7 / context_key
Last active August 30, 2017 12:50
Babel
{'!pdoMenu' | snippet : [
'parents' => '[[*context_key:is=`web`:then=`1`:else=`[[*context_key:is=`en`:then=`8`]]`]]',
'level' => '1',
'tplOuter' => '@INLINE <div class="dropdown">{{+wrapper}}</div>',
'tpl' => '@INLINE <p><a href="{{+link}}" {{+attributes}}>{{+menutitle}}</a></p>'
]}
@Sentinel-7
Sentinel-7 / file.js
Created October 3, 2017 11:50
HTML + js +pdf
<script type="text/javascript" src="//code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type="text/javascript" src="https://github.com/niklasvh/html2canvas/releases/download/v0.5.0-beta4/html2canvas.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/MrRio/jsPDF/master/dist/jspdf.min.js"></script>
<script type='text/javascript'>
function demoFromHTML() {
var pdf = new jsPDF('p', 'pt', 'letter');
var options = {ignore}{background: '#fff'}{/ignore};
var pdfContainer = $(".pdf");
@Sentinel-7
Sentinel-7 / AceTv plugin
Created December 19, 2017 07:04
AceTv plugin для подсветки кода
//там ещё RTE подключается для определенные категорий ресуров)
//создаем плагин AceTv, событие на «OnDocFormRender» с кодом:
$script = '';
$resource = ($resource instanceof modResource)
?
$modx->getObject('modResource',$resource->get('id'))
: $modx->getObject('modResource',(int)$resource);
// ACE
// начиная с 367 строке
{
xtype: 'bannery-filter-resources'
,fieldLabel: _('bannery.ads.url')
,name: 'url'
,description: _('bannery.ads.url.description')
,anchor: '99%'
,allowBlank: true
},{
xtype: 'textarea'
@Sentinel-7
Sentinel-7 / plugin
Created January 25, 2018 15:48
Grabber
<?php
define('ROOT', MODX_BASE_PATH);
define('EX', 'jpg,png,gif,jpeg,doc,xls,zip,pdf'); // Через запятую имена расширений (нижний регистр)
$folder=isset($folder) ? $folder : "assets/images/"; // папка назначения стыренного контента
if(!is_dir(MODX_BASE_PATH.$folder)) mkdir(MODX_BASE_PATH.$folder);
// Функция траслита
function rus2translit($string) {
$converter = array(
'а' => 'a', 'б' => 'b', 'в' => 'v',
'г' => 'g', 'д' => 'd', 'е' => 'e',