Rootiys

Rootiys

С нами с 07 сентября 2013; Место в рейтинге пользователей: #179
Сергей Шлоков
29 октября 2018, 12:11
1
+3
Например, так
{set $year = intval($.get.year)}
{'!pdoResources' | snippet : [
    ...
   'where' => ["DATE_FORMAT(FROM_UNIXTIME(createdon), '%Y') = " ~ $year]
]}
Володя
12 ноября 2017, 19:40
6
+4
— создаем настройку в медиасорс hideSource булево. Задаем в да.
— плагин на OnMediaSourceGetProperties
$properties = json_decode($properties, true);
if (!empty($properties['hideSource']) AND !empty($properties['hideSource']['value']) AND $_REQUEST['node'] == '/') {
    die('{}');
}
все.

ps. посмотрев в $_REQUEST можно увидеть переменные и продумать скрытие в дереве, в окне и тд…
как фантазия ваша разыграется.
Роман
03 сентября 2017, 12:29
1
0
А вот такое уже выводить не хочет. Есть варианты обойти?
{{+tv.image:phpthumbon=`w=75`}}
Alex
01 июля 2017, 16:31
1
0
В общем с процессорами ничего у меня не вышло, не стал заморачиваться и сделал так, теперь все ок:
<?php
$resource_id = '22';

$modx->ms2Gallery = $modx->getService('ms2gallery', 'ms2Gallery', MODX_CORE_PATH . 'components/ms2gallery/model/ms2gallery/');
$prefix = $modx->config['table_prefix'];

$sql = "SELECT id FROM {$prefix}ms2_resource_files WHERE `resource_id` = {$resource_id} AND `parent` = 0 ORDER BY id ASC";
$q = $modx->prepare($sql);
$q->execute();
$ms2Gallery_arr = $q->fetchAll(PDO::FETCH_ASSOC);

foreach ($ms2Gallery_arr as $k => $ms2Gallery_ids) {
    foreach ($ms2Gallery_ids as $v){
        $ms2Gallery_id[$k] = $v;
    }
}
$img_titles = array(
            'черный','черный','черный','белый','белый','белый','бежевый','бежевый','бежевый','черный',
        );
$img_arr = array_combine($ms2Gallery_id,$img_titles);

foreach ($img_arr as $img_key => $img_value){
    $newTag = $modx->newObject('msResourceFileTag');
    $newTag->set('file_id', $img_key);
    $newTag->set('tag', $img_value);
    $newTag->save();
}
Решено.
Володя
30 июня 2017, 21:25
4
+2
как недавно выяснилось есть волшебный параметр ra
добавь его, а фон убери, вот так
"catalog":{"w":215,"h":245,"q":65,"zc":"0","bg":"","ra":1}
Владимир
30 июня 2017, 10:11
1
0
перенеси вопрос в «вопросы», только там отвечают
Василий Наумкин
06 февраля 2017, 08:28
3
+3
Нужно использовать волшебный параметр
&scheme=`uri`
тогда для адресов страниц будет использоваться их uri, без запуска функции modX::makeUrl().

Вот лог modx.pro:
0.0000691: pdoTools loaded
0.0000439: Conditions prepared
0.0000050: Query parameters ready
0.0000920: No cached data for key «default/sitemap/13f0b2»
0.0000150: xPDO query object created
0.0000861: Added selection of modResource: SQL_CALC_FOUND_ROWS `id`, `editedon`, `createdon`, `context_key`, `class_key`, `uri`, `content`
0.0000200: Processed additional conditions
0.0002549: Added where condition: modResource.hidemenu=0, OR:modResource.class_key:IN(Ticket,Article), modResource.published=1, modResource.deleted=0, modResource.searchable=1, modResource.context_key=web
0.0000701: Sorted by modResource.menuindex, asc
0.0002680: SQL prepared «SELECT SQL_CALC_FOUND_ROWS `modResource`.`id`, `modResource`.`editedon`, `modResource`.`createdon`, `modResource`.`context_key`, `modResource`.`class_key`, `modResource`.`uri`, `modResource`.`content` FROM `b2QHetSLC6ET_site_content` AS `modResource` WHERE ( ( `modResource`.`hidemenu` = 0 OR `modResource`.`class_key` IN ('Ticket','Article') ) AND `modResource`.`published` = 1 AND `modResource`.`deleted` = 0 AND `modResource`.`searchable` = 1 AND `modResource`.`context_key` = 'web' ) ORDER BY modResource.menuindex asc „
0.1018419: SQL executed
0.0021629: Total rows: 9786
0.0283070: Rows fetched
0.0230331: Returning raw data
0.0005159: Created inline “modChunk» with name «93a97ed9d66e351bc63bf3ddfa38f405»
0.0122530: Compiled Fenom chunk with name «modchunk/93a97ed9d66e351bc63bf3ddfa38f405»
0.1083400: Rows processed
0.0142739: Saved data to cache «default/sitemap/13f0b2»
0.0096161: Created inline «modChunk» with name «be75dd4b9525127c59b774f94767849c»
0.0241339: Rows wrapped
0.3255181: Total time
82 395 136: Memory usage

Вот такой вызов:
[[!pdoSitemap?
	&scheme=`uri`
	&tpl=`@INLINE
	<url>
		<loc>{$_modx->config.site_url}{$url}</loc>
		<lastmod>{$date}</lastmod>
		<changefreq>{$update}</changefreq>
		<priority>{$priority}</priority>
	</url>`
]]
Володя
05 августа 2016, 22:35
21
+5
можно добавить так
создать плагин на pdoToolsOnFenomInit, в нем добавить модификатор detector
<?php
switch ($modx->event->name) {
    case 'pdoToolsOnFenomInit':
    if (!$fenom = $modx->getOption('fenom', $scriptProperties)) {
        return;
    }
    if (!$MobileDetect = $modx->getService('mobiledetect', 'MobileDetect', MODX_CORE_PATH . 'components/mobiledetect/')) {
	    return;
    }
    
    $key = $MobileDetect->config['force_browser_variable'];
    $device = !empty($_GET) && array_key_exists($key, $_GET)
		? $modx->stripTags($_GET[$key])
		: '';
	if (empty($device)) {
	    $device = $MobileDetect->getSettings();
    }
    if (empty($device)) {
        $detector = $MobileDetect->getDetector();
        $device = ($detector->isMobile() ? ($detector->isTablet() ? 'tablet' : 'mobile') : 'standard');
        $MobileDetect->saveSettings($device);
    }

    $fenom->addModifier("detector", function ($value) use ($device) {
        return $value == $device;
    });

    break;
}

и теперь в любом месте можно делать так
{if 'mobile'|detector}
mobile
{/if}

{if 'tablet'|detector}
tablet
{/if}

{if 'standard'|detector}
standard
{/if}
Марат Марабар
06 июля 2016, 15:45
1
+3
$('.price').click(function(){
	var name = $(this).attr('name');
	$('#tarif').val(name);
})