Skip to content

Instantly share code, notes, and snippets.

View goldsky's full-sized avatar

rico goldsky

View GitHub Profile
@goldsky
goldsky / step2DynamicFields.wrapper.html
Created June 21, 2014 11:26
Wrapper chunk for step-2 field of dynamic field for FormIt
[[+dynfield.items]]
<script>
function addRow(button) {
var newRow = '[[$step2DynamicFields.item:chunkToJsProperty]]' + "&nbsp;\n";
$(newRow).insertBefore($(button));
}
function removeRow(button) {
$(button).parent().parent().remove();
}
</script>
@goldsky
goldsky / fiDynamicFieldsEmail.php
Last active November 27, 2016 12:06
Helper snippet to render the dynamic values from FormIt
<?php
/**
* fiDynamicFields snippet
*
* the snippet to manipulate this dynamic form, to parse the HTML code and
* to hold the submitted values if the page goes back to the same page.
*
* @link http://www.virtudraft.com/blog/dynamic-fields-in-multiple-pages-for-formit.html
* @author goldsky <[email protected]>
@goldsky
goldsky / emailTpl.html
Last active August 29, 2015 14:02
Example of email template when using dynamic field for FormIt
<p>Hello Admin,</p>
<p>Someone has sent the application form.</p>
<table style="border: none;">
<tr>
<td colspan="3">Personal Details</td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
@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>
@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 / 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 / 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 / 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 <[email protected]>
* @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 / .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 / 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';