Skip to content

Instantly share code, notes, and snippets.

@christianseel
christianseel / modxcloud nginx web rules
Last active March 31, 2016 20:32
# x-ua-xompatible # expire headers for assets # www.mydomain.com -> mydomain.com # filename-based cache busting # trailing slash redirect # statcache rewrite # modx furls rewrite
# x-ua-xompatible header
add_header X-UA-Compatible IE=edge,chrome=1;
#default charset uft-8
charset utf-8;
# allowed domains
set $rewrite_var 0;
@christianseel
christianseel / gist:5013671
Created February 22, 2013 14:12
GoogleSitemap Snippet: use latest publication date as date field for articles container
if ($child instanceof ArticlesContainer) {
$date = $this->modx->runSnippet('getResources',array(
'showHidden' => '1',
'parents' => $id,
'depth' => '1',
'limit' => '1',
'published' => '1',
'sortby' => '{"publishedon":"DESC"}',
'tpl' => 'getResources.publishedon'
));
@christianseel
christianseel / .htaccess
Last active December 27, 2015 20:19
MODX Revolution default .htaccess for All-Inkl.com
# ----------------------------------------------------------------------
# PHP Settings
# ----------------------------------------------------------------------
# php cgi 5.4.x
AddHandler php54-cgi .php
# set default timezone
php_value date.timezone "Europe/Berlin"
@christianseel
christianseel / Remove SeoTab Branding
Created February 20, 2014 16:55
Add this php code as a plugin to your MODX manager and check the 'OnDocFormPrerender' system event. This removes the branding from the SEOTab extra by Sterc.
<?php
$modx->regClientStartupHTMLBlock('<style>
#modx-resource-tabs__seo-tab {
border-color: #658F1A;
background: url(/manager/templates/default/images/modx-theme/tabs/tab-bg.svg) #658F1A;
background: -moz-linear-gradient(center bottom,#658F1A 0%,#8BAF4C 100%) repeat scroll 0 0 transparent;
background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#8BAF4C),color-stop(100%,#658F1A));
background: -webkit-linear-gradient(center bottom,#658F1A 0%,#8BAF4C 100%);
background: -o-linear-gradient(center bottom,#658F1A 0%,#8BAF4C 100%);
background: -ms-linear-gradient(center bottom,#658F1A 0%,#8BAF4C 100%);
@christianseel
christianseel / hinweise.js
Created April 10, 2014 20:43
Dieser JS Code fügt in die rechte Spalte einer Resource beliebigen HTML Code ein (z.B. Hinweise). Sollte per Plugin OnDocFormPreRender eingefügt werden.
var content = '';
content += '<h3>Hinweise</h3>';
content += '<p>Hinweistext</p>';
content += '<style>.hdkInfo-panel p {margin-bottom: 10px; line-height:1.6;} .hdkInfo-panel h4 {margin-top: 15px; margin-bottom: 5px;}</style>';
var hdkInfo = function(config) {
@christianseel
christianseel / moregallery img to TV
Last active August 29, 2015 14:01
Add this as a plugin (OnDocFormSave). Saves the first MoreGallery image into a TV (could be a hidden one) for quicker access.
// Get the images
$corePath = $modx->getOption('moregallery.core_path', null, $modx->getOption('core_path') . 'components/moregallery/');
$moreGallery = $modx->getService('moregallery', 'moreGallery', $corePath . 'model/moregallery/');
$c = $modx->newQuery('mgImage');
$c->where(array(
'resource' => $resource->get('id'),
));
$c->sortby('sortorder', 'ASC');
$c->limit('1');
@christianseel
christianseel / .htaccess
Created July 6, 2014 12:19 — forked from splittingred/.htaccess
MODX 2.3 REST example
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ rest/index.php?_rest=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ rest/index.php [QSA,NC,L]
</IfModule>
@christianseel
christianseel / babel.css
Created July 30, 2014 07:13
Updated CSS for Babel in MODX 2.3.x – quick&dirty
/**
* Babel CSS file
*
* @author Jakob Class <jakob.class@class-zec.de>
*
* @package babel
*/
#babel-box{
background: rgba(230,230,230,.7);
margin: 0px 0 0;
@christianseel
christianseel / introRTE
Created August 14, 2014 14:52
RTE for introtext #modx
<?php
// Add RTE for introtext if richtext option is enabled for the resource
// check "OnDocFormRender" event
$modx->regClientStartupHTMLBlock('<script>Ext.onReady(function() {
if(MODx.loadRTE) MODx.loadRTE("modx-resource-introtext");
});</script>');
@christianseel
christianseel / Chunk tabNavigationItem
Last active November 8, 2023 11:47
"generateTabs" output filter for ContentBlocks. See http://slides.com/christianseel/contentblocks/ for instructions.
<li class="tab-title [[+idx:is=`1`:then=`active`:else=``]]" role="presentational">
<a href="#[[+id]]" role="tab" tabindex="0" aria-selected="false" controls="[[+id]]">[[+title]]</a>
</li>