Skip to content

Instantly share code, notes, and snippets.

View dubrod's full-sized avatar

Wayne Roddy dubrod

View GitHub Profile
QUERIES
$resources = $modx->getCollection('modResource', array('published'=>'1','hidemenu'=>'0','isfolder'=>'1','parent'=>'16','class_key'=>'modDocument'));
foreach($resources as $resource) {
$id = $resource->get('id');
$thumb = $resource->getTVValue('thumbImage');
}
OR--
https://rtfm.modx.com/revolution/2.x/developing-in-modx/advanced-development/modx-services/modmail
/* modx mail service */
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY,$message);
$modx->mail->set(modMail::MAIL_FROM,$from);
$modx->mail->set(modMail::MAIL_FROM_NAME,'Quick Quote');
$modx->mail->set(modMail::MAIL_SUBJECT,'Lease Quote #'.$id.'');
$modx->mail->address('to','sales@theleaseoutlet.dsmessage.com');
//$modx->mail->address('reply-to','me@xexample.org');
@dubrod
dubrod / modx-siblingnav
Last active November 30, 2018 00:45
Simpler MODX Sibling Nav for all children with just previous and next output
[[!siblingNav? &parents=`4` &limit=`4` &sortBy=`{"publishedon":"DESC"}` &prevTpl=`mxt.prevTpl` &nextTpl=`mxt.nextTpl`]]
<ul class="clearfix">[[+sn.prev]][[-+sn.prevlinks]][[-+sn.nextlinks]][[+sn.next]]</ul>
PREV
<li>[[+_isactive:is=`1`:then=`<a href="[[~[[+id]]]]">&laquo; [[+pagetitle]]</a>`:else=` &laquo; `]]</li>
//////
Friendly URL container_suffix must = /
System Setting:
Key: archivist.archive_ids
name empty
namespace: archivist
area lexicon: furls
value: 18:arc_ (18 being resource id)
Archive Template ( needs to be container )
@dubrod
dubrod / modx-form-snips
Created November 30, 2018 00:43
collection of modx form snips
http://rtfm.modx.com/extras/revo/formit/formit.tutorials-and-examples/formit.handling-selects,-checkboxes-and-radios
[[!FormIt?
&hooks=`spam,email,redirect`
&emailTpl=`ContactEmailTpl`
&emailFrom=`[[++emailsender]]`
&emailTo=`wayne@modx.com`
&emailUseFieldForSubject=`1`
&redirectTo=`33`
&validate=`name:required,
@dubrod
dubrod / modx-parent-snips
Created November 30, 2018 00:40
collection of modx parent snippets
GetParentAlias
$output = '';
/* Get the current resource's 'parent' field */
$parentId = $modx->resource->get('parent');
/* Get the parent object */
$parentObj = $modx->getObject('modResource', $parentId);
@dubrod
dubrod / jquery-device-detect
Created June 17, 2014 15:59
jQuery Device Detect via User Agent
//touch/mobile detection
if (
navigator.userAgent.match(/Phone/i) ||
navigator.userAgent.match(/DROID/i) ||
navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/) ||
navigator.userAgent.match(/Windows Phone/i) ||
@dubrod
dubrod / Using Radio Buttons on Color Selector Plus for Magento
Last active February 19, 2018 14:38
Configurable.phtml File for Magento that will switch SELECT to RADIO Buttons. Some customization required. This is not an automated extension but rather a hack. Working on a live site and tested on Magento 1.7 -- Full Instructions will be available on our blog, http://www.revitalagency.com/blog This file is at: template/colorselectorplus/catalog…
<?php
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
$swatch_attributes = Mage::helper('colorselectorplus')->getSwatchAttributes();
$title = Mage::getStoreConfig('color_selector_plus/colorselectorplusgeneral/title', Mage::app()->getStore());
$hide = Mage::getStoreConfig('color_selector_plus/colorselectorplusgeneral/hidedropdown', Mage::app()->getStore());
?>
<?php if ($_product->isSaleable() && count($_attributes)): ?>
<dl>
@dubrod
dubrod / modx-user-profile-photo
Last active October 7, 2016 11:27
4 part MODX User Profile Upload. Not 1 large script.
// == Script Origin and Discussion
// https://forums.modx.com/thread/?thread=80740&page=2
// Used Oct 2016 on MODX 2.5
// == Form Markup
[[!UpdateProfile? &validate=`fullname:required,email:required:email` &preHooks=`UploadProfilePhoto`]]
<label for="Profile_Photos">Profile Photo <span class="error">[[!+fi.error.Profile_Photos]]</span></label>
<img src="[[+Profile_Photos:phpthumbof=`w=210&h=210`]]" />
<input id="Profile_Photos" name="Profile_Photos" type="file" value="[[+fi.Profile_Photos]]" maxlength="100000" />
@dubrod
dubrod / modx-user-dob-table
Last active July 6, 2016 20:04
Display a Table Count of Users by DOB
//SNIPPET
$datearr = [];
$users = $modx->getIterator('modUser', array('active'=>'1'));
foreach ($users as $user) {
$profile = $user->getOne('Profile');
$dob = date("Y", $profile->get('dob'));