Skip to content

Instantly share code, notes, and snippets.

Wayne Roddy dubrod

  • MODX
  • Inverness, FL
View GitHub Profile
@dubrod
dubrod / MODX ID to JSON
Last active Jan 23, 2019
MODX ID to JSON
View MODX ID to JSON
<?php
header("Content-Type:application/json");
$id = $_GET["id"];
if(empty($id)){ die(); }
$obj = $modx->getObject('modResource', $id);
$output = [];
@dubrod
dubrod / modx-up-title
Created Nov 30, 2018
simple ultimate parent title
View modx-up-title
<?php
//4 levels deep
$title = '';
//first level parent
$parentId = $modx->resource->get('parent');
if($parentId == 0){
$title = $modx->parseChunk('interior-title', array('title' => $modx->resource->get('pagetitle') ));
return $title;
View modx-tagger-notes
Group 1 = Category | Combo Box
Group 2 = Keywords | Tag field
Category Template
Snippet = [[cateName]]
<?php
$get = modX::sanitize($_GET, $modx->sanitizePatterns);
$tag = ucfirst(urldecode($get['categories']));
$tag = str_replace("-"," ", $tag);
View modx-snippet-notes
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--
View modx-mail-notes
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');
View modx-archivist-notes
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 Nov 30, 2018
collection of modx form snips
View 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 Nov 30, 2018
collection of modx parent snippets
View modx-parent-snips
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 / modx-siblingnav
Last active Nov 30, 2018
Simpler MODX Sibling Nav for all children with just previous and next output
View modx-siblingnav
[[!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>
//////
@dubrod
dubrod / modx-user-profile-photo
Last active Oct 7, 2016
4 part MODX User Profile Upload. Not 1 large script.
View modx-user-profile-photo
// == 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" />
You can’t perform that action at this time.