Skip to content

Instantly share code, notes, and snippets.

@OlegShchavelev
OlegShchavelev / main.tpl
Created August 8, 2017 17:42
Migx Fenom
{set $rows = json_decode($_modx->resource.image_section3, true)}
<ul class="uk-grid uk-slideset">
{foreach $rows as $row}
<li><div class="tm-notifications-item"><img src="{$row.image}" alt="{$row.title}"></div></li>
{/foreach}
</ul>
@OlegShchavelev
OlegShchavelev / main.tpl
Created August 8, 2017 12:11
Cчитаем количество ресурсов, в снипете pdoResources
{'!pdoResources' | snippet : [
'totalVar' => total_main
]}
$_modx->getPlaceholder('total_main')
@OlegShchavelev
OlegShchavelev / index.tpl
Last active July 21, 2017 15:17
Множественная проверка значений
// Если одно поле заполнено
{if $_modx->resource.pagetitle_section1 != '' || $_modx->resource.introtext_section1 != '' || $_modx->resource.image_section1}
{/if}
//Если все поля заполнены
{if $_modx->resource.pagetitle_section1 != '' && $_modx->resource.introtext_section1 != '' && $_modx->resource.image_section1}
{/if}
{'!AjaxForm' | snippet: [
'snippet' => 'FormIt',
'form' => 'tpl.AjaxForm.dtls',
'hooks' => 'FormItSaveForm, email',
'formFields' => 'name,phone,email1,message',
'fieldNames' => 'name==Имя отправителя,phone==Телефон,email1==Почта,message==Комментарии'
'validate' => 'name:required',
'emailSubject' => 'Заявка из раздела контакты',
'emailTo' => '[email protected]',
'emailTpl' => 'tpl.email.dtls',
@OlegShchavelev
OlegShchavelev / index.tpl
Created June 12, 2017 16:41
Изменения падежа при плейсхолдерах числительных
{'!count' | snippet: [
'parents' => $id ] | units : 'товар|товара|товаров'}
@OlegShchavelev
OlegShchavelev / index.tpl
Last active June 10, 2017 13:39
Модуль с этим товары покупают
{'!msProducts' | snippet : [
'parents' => '0',
'tpl' => 'lookedTpl.dtls',
'includeThumbs' => 'medium',
'link' => '1',
'master' => $_modx->resource.id
]}
@OlegShchavelev
OlegShchavelev / style.css
Created June 10, 2017 12:13
Выравнивание по вертикали заголовка
.inner-collect3 .title30Custom a {
vertical-align: middle;
display: table-cell;
height: 62px;
line-height: 24px;
}
@OlegShchavelev
OlegShchavelev / main.tpl
Created June 9, 2017 21:11
MSProduct фильтрация по тегам MS2
{'!msProducts' | snippet : [
'parents' => 3,
'includeThumbs' => 'medium',
'tpl' => 'mainrowInfo',
'where' => ['Data.tags:LIKE' => '%Associated%']
]}
@OlegShchavelev
OlegShchavelev / count.php
Created June 9, 2017 13:58
Считаем дочерние ресурсы
<?php
$pars = array(
'parents' => $parents,
'depth' => $depth,
'totalVar' => 'count',
'where' => $where
);
$modx -> runSnippet('pdoResources', $pars);
return '[[+count]]';
@OlegShchavelev
OlegShchavelev / tags_lister
Last active June 6, 2017 13:38
getResourcesTag
{'!tagLister' | snippet : [
'items' => $_modx->resource.tags,
'target' => 13,
'tpl' => 'listerTpl',
'parents' => '5'
]}