Skip to content

Instantly share code, notes, and snippets.

View MODx number of Tickets comments
if ($thread = $modx->getObject('TicketThread', array('resource' => $id))) {
echo $thread->get('comments');
View minishop2 MODx gallery thumbnail's size
View BannerY MODx setup position in template
&tpl=`@INLINE <a href="[[+url]]" target="_blank"><img src="[[+image]]" alt="[[+name]]" class="img-responsive" title="[[+description]]"></a>`
View Hide Robots.txt use htaccess
Options +FollowSymlinks
RewriteBase /
RewriteRule ^robots.txt$ /robot.php?%{REQUEST_URI}
View VersionX db clean
* versionCleanX
* @author Scott Pronych, September 27, 2013
* For use with VersionX to delete old content
View OpenGraph MODx
<meta property="og:title" content="[[*pagetitle]]"/>
<meta property="og:site_name" content="[[++site_name]]"/>
<meta property="og:url" content="[[++site_url]][[*uri]]"/>
<meta property="og:description" content="[[*content:notags:limit=`200`]]"/>
<meta property="og:image" content="[[++site_url]][[*tvname]]"/>
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="[[*pagetitle]]" />
<meta name="twitter:image:src" content="[[++site_url]][[*tvname]]" />
<meta name="twitter:description" content="[[*content:notags:limit=`200`]]" />
<link rel="image_src" href="[[++site_url]][[*image]]" />
View Получение заголовка видео с youtube
if ($mode == 'new') {
if (strpos(trim($resource->pagetitle), ' ') === false) {
$url = '' . $resource->pagetitle;
$html = file_get_contents($url);
$dom = new DomDocument();
$dom->loadHTML('<?xml version="1.0" encoding="UTF-8"?>'. $html);
if ($title = $dom->getElementById('eow-title')) {
$modx->log(1, $resource->pagetitle);
$video_id = $resource->pagetitle;
View Подгрузка статей кнопкой с помощью pdoPage
<div class="news-items" id="newsItems">
<div class="rows" style="overflow: hidden;">
View Разбивка страниц по категориям (родителям)
<div id="pdopage">
<div class="rows">
&sortby=`{"p_menuindex":"ASC", "publishedon":"DESC"}`
View Удалить index из URL ресурсов, дочерних главной
switch ($modx->event->name) {
case 'OnWebPagePrerender':
$modx->resource->_output = str_replace('"index/', '"', $modx->resource->_output);
case 'OnPageNotFound':
$uri = explode('?', $_SERVER['REQUEST_URI']);
if ($res = $modx->findResource('index' . $uri[0])) {