Skip to content

Instantly share code, notes, and snippets.

View goldsky's full-sized avatar

rico goldsky

View GitHub Profile
@goldsky
goldsky / refresh-static-elements.php
Last active June 12, 2018 03:36
Refresh all static elements entirely
<?php
/**
* Refresh all static elements entirely
* MODX Revolution
* @author goldsky@virtudraft.com
*/
define('MODX_API_MODE', true);
/**
* CHANGE this reference to the main index.php!
*/
@goldsky
goldsky / getGalleryCoverByTV.php
Last active April 28, 2017 09:23
Get gallery's cover from Template Variable
<?php
/**
* getGalleryCoverByTV snippet
* Get gallery's cover from Template Variable
*
* @author goldsky <goldsky@virtudraft.com>
* @license GPLv3
*/
$toPlaceholder = $modx->getOption('toPlaceholder', $scriptProperties);
@goldsky
goldsky / getTVText.php
Last active June 23, 2023 12:53
Dynamically Render MODX's Template Variable on front-end to get Text and Value
<?php
/**
* getTVText snippet
*
* Dynamically Render Template Variable on front-end to get not only the value,
* but also its input's "text"
*
* @author goldsky <goldsky@virtudraft.com>
*
@goldsky
goldsky / xrouting.plugin.php
Created February 15, 2016 15:33
Edited xrouting
<?php
switch ($modx->event->name) {
// "refresh cache" part
case 'OnContextSave':
case 'OnContextRemove':
case 'OnSiteRefresh':
$contexts = array();
$cacheKey = 'xrouting_contextmap';
@goldsky
goldsky / .htaccess
Created February 15, 2016 15:27
htaccess example for Babel
# MODX supports Friendly URLs via this .htaccess file. You must serve web
# pages via Apache with mod_rewrite to use this functionality, and you must
# change the file name from ht.access to .htaccess.
#
# Make sure RewriteBase points to the directory where you installed MODX.
# E.g., "/modx" if your installation is in a "modx" subdirectory.
#
# You may choose to make your URLs non-case-sensitive by adding a NC directive
# to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
@goldsky
goldsky / includeFile.snippet.php
Last active July 20, 2016 12:46
includeFile snippet is to include any file in MODX's page, either in resource, template, or chunk
<?php
/**
* includeFile snippet is to include any file in MODX's page, either in resource, template, or chunk
*
* @author goldsky <goldsky@virtudraft.com>
* @copyright Copyright (c) 2015, goldsky
* @example [[!includeFile? &file=`[[++core_path]]statics/chunks/mychunk.chunk.tpl`]]
* [[!includeFile? &file=`[[++core_path]]statics/snippets/mysnippet.snippet.php`]]
*
@goldsky
goldsky / step2DynamicFieldsEmail.wrapper.html
Created June 21, 2014 12:56
Wrapper template for fiDynamicFieldsEmail snippet to revert dynamic field in step-2
<tr>
<td>Positions</td>
<td>:</td>
<td><ul>[[+dynfield.items]]</ul></td>
</tr>
@goldsky
goldsky / step2DynamicFieldsEmail.item.html
Created June 21, 2014 12:55
Row template for fiDynamicFieldsEmail snippet to revert dynamic field in step-2
<li>[[+dynfield.position]]</li>
@goldsky
goldsky / step1DynamicFieldsEmail.wrapper.html
Created June 21, 2014 12:43
Wrapper template for fiDynamicFieldsEmail snippet to revert dynamic field in step-1
<tr>
<td>Telephones</td>
<td>:</td>
<td><ul>[[+dynfield.items]]</ul></td>
</tr>
@goldsky
goldsky / step1DynamicFieldsEmail.item.html
Created June 21, 2014 12:42
Row template for fiDynamicFieldsEmail snippet to revert dynamic field in step-1
<li>[[+dynfield.telephone]]</li>