Skip to content

Instantly share code, notes, and snippets.

@pepebe
pepebe / gist:1753152
Created February 6, 2012 16:34
MIGX - Interesting Links
Loose collection of links to various topics regarding MIGX by Bruno17
@pepebe
pepebe / gist:1753236
Created February 6, 2012 16:47
MIGX - Add sortby and sortdir to MIGX output.
Just a tiny hack to enable sorting a MIGx by ANY ot it's columns.
Add the following lines below /* get default properties */ near the top:
$sortBy = $modx->getOption('sortBy', $scriptProperties, '');
$sortOrder = $modx->getOption('sortOrder', $scriptProperties, 'asc');
Just before $idx = 0; (arround line #122) add this bit of code:
@pepebe
pepebe / gist:1759459
Created February 7, 2012 12:26
MODX: change the contents of a page based on a group of users
by http://forums.modx.com/u/BobRay
<?php
/* InGroup snippet */
$output = "";
if ($modx->user->isMember('groupA')) {
$output = $modx->getChunk('chunk1');
} else if ($modx->user->isMember('GroupB')) {
$output = $modx->getChunk('chunk2');
} else {
@pepebe
pepebe / gist:1900992
Created February 24, 2012 13:36
js remove broken image from dom
<img src="brokenimageling.jpg" onerror="this.style.display='none'">
@pepebe
pepebe / Executioner.snippet.php
Created February 24, 2012 19:37 — forked from opengeek/Executioner.snippet.php
MODX REVO : Executioner snippet
<?php
/*
Fork of the original executioner snippet by opengeek
Usage:
[[!Executioner?
&tElementClass=`modSnippet`
&tEcho=`comment`
&tElement=`getResourceField`
&id=`27`
@pepebe
pepebe / gist:1923032
Created February 27, 2012 10:39
MODX: speed up wayfinder calls
http://forums.modx.com/thread/39979/wayfinder-slowness-issue?page=3#dis-post-413494
developed by Lucas
Idea: Speed up wf by creating a static wayfinder chunk every time a document is saved. (should slow down manager).
a) create a chunk. Leave it empty. Name it whatever you want, e.g. testMenu
b) create a plugin. Enter this:
$myChunk = 'testMenu';
$params['startId'] = '0';
@pepebe
pepebe / gist:1924151
Created February 27, 2012 14:22
MODx: REFRESH / CLEAR MODX (REVOLUTION) CACHE FROM PHP SCRIPT REFRESH / CLEAR MODX (REVOLUTION) CACHE FROM PHP SCRIPT
<?php
/* Downloaded from: http://www.dangibbs.co.uk/journal/clear-modx-revolution-cache-from-php-script
UNTESTED!!!
*/
/*
* Clear (refresh) MODx Cache from external PHP Script
*
* MODx Revolution (2.0.7-pl)
* Daniel Gibbs
@pepebe
pepebe / gist:2023027
Created March 12, 2012 16:09
MODX: MIGX usefull things to know...
Pass a parameter to getImageList
Example:
[[!getImageList?
&docid=`120`
&tvname=`contactinfo migx`
&tpl=`contactinfo.migx.tpl`
&contact=`[[+contact]]`
]]
@pepebe
pepebe / gist:2023170
Created March 12, 2012 16:27
MIGX: Enable sorting by any columns in MIGX
this worked 8 months before. I have to check if it is still working...
Just a tiny hack to enable sorting a MIGx by ANY one of it's columns.
Add the following lines below /* get default properties */ near the top:
$sortBy = $modx->getOption('sortBy', $scriptProperties, '');
$sortOrder = $modx->getOption('sortOrder', $scriptProperties, 'asc');
@pepebe
pepebe / return_document_depth.php
Created March 16, 2012 10:06
MODX.Snippet: Return document depth
<?php
/* Return document depth
* Author: Aaron Ladage - eatsleepmodx.com
* Published: http://www.gregorysmart.com/2010/05/27/guest-post-count-levels-in-modx/
* */
$output = '';
$id = $modx->documentIdentifier;
$levelcount = count($modx->getParentIds($id));
$output .= $levelcount;
return $output;