Skip to content

Instantly share code, notes, and snippets.

<?php
$output = '';
$tElementClass = !empty($tElementClass) ? $tElementClass : 'modSnippet';
$tStart = $modx->getMicroTime();
if (!empty($tElement)) {
switch ($tElementClass) {
case 'modChunk':
$output = $modx->getChunk($tElement, $scriptProperties);
break;
@rtripault
rtripault / Input Option Values :
Created November 25, 2010 09:51
MODx Revolution snippet to list resources of a given parent in order to output it in Option Values of a TV
@EVAL return $modx->runSnippet('getAside');
@avoronkin
avoronkin / FormIt2AddUser.php
Created February 17, 2011 09:57
FormIt custom hook
<?php
$debug = $modx->getOption('debug', $scriptProperties, false);
if ($debug) {
$modx->setLogLevel(modX::LOG_LEVEL_DEBUG);
}
//new user object
$user = $modx->newObject('modUser');
//get all form fields
$formFields = $hook->getValues();
@balupton
balupton / README.md
Last active April 20, 2022 13:21
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@faisalman
faisalman / print_r.js
Last active September 13, 2021 02:57
PHP-like print_r() & var_dump() equivalent for JavaScript
/**
* PHP-like print_r() equivalent for JavaScript Object
*
* @author Faisalman <fyzlman@gmail.com>
* @license http://www.opensource.org/licenses/mit-license.php
* @link http://gist.github.com/879208
*/
var print_r = function (obj, t) {
// define tab spacing
@Mark-H
Mark-H / gist:962492
Created May 9, 2011 13:14
Simple snippet (output filter) for MODX Revolution related items. Call as [[snippetname? &tpl=`chunkname` &input=`[[*your-comma-delimited-id-tv]]`]]
<?php
if ($input == null) { return 'No relevant items found.'; }
$tpl = $modx->getOption('tpl',$scriptProperties,null);
if (($tpl === null) || (!$modx->getChunk($tpl))) { return 'No template found'; }
$ids = explode (',', $input);
foreach ($ids as $a => $key) {
$document = $modx->getObject('modResource', array(
'published' => 1,
@Mark-H
Mark-H / simplx_toplaceholders.php
Created June 23, 2011 09:56 — forked from larscwallin/simplx_toplaceholders.php
MODx toPlaceholders wrapper
<?php
/*
Snippet "simplx_toplaceholders"
KISS Snippet which wraps the $modx equivalent, only adds the ability to use JSON input.
Example:
@splittingred
splittingred / snippet.include.php
Created August 3, 2011 21:20
include snippet for MODX Revolution
if (empty($file)) return '';
$o = '';
$modx->parser->processElementTags('',$file,true,true);
$file = str_replace(array(
'{core_path}',
'{base_path}',
'{assets_path}',
),array(
$modx->getOption('core_path'),
@xeoncross
xeoncross / hacks.css
Created August 10, 2011 18:28
CSS hacks
/*
Comprehensive List of Browser-Specific CSS Hacks
http://paulirish.com/2009/browser-specific-css-hacks/
*/
/***** Selector Hacks ******/
/* IE6 and below */
* html #uno { color: red }
@jonahbron
jonahbron / htmltidy-kodomo-macro.js
Created August 18, 2011 18:08
An HTMLTidy Macro for Komodo Edit
/*
HTML Tidy Macro for Komodo Edit
Pipes tidy output through sed to convert space indentation to tabs (tidy doesn't support tab indentation).
Requires that tidy and sed be installed.
BSD License
*/
komodo.assertMacroVersion(3);
if (komodo.view) { komodo.view.setFocus(); }