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 / Commonly Used MODX Head Tags
Last active Jan 7, 2019
Commonly Used MODX Head Tags for use in my Public Snapshots
View Commonly Used MODX Head Tags
<title>[[*pagetitle]]</title>
<title>[[*longtitle:default=`[[*pagetitle]]`]]</title>
<meta name="description" content="[[*description]]">
<meta name="keywords" content="[[*keywords]]">
<meta itemprop="url" content="[[~[[*id? &scheme=`full`]]]]">
<meta itemprop="name headline" content="[[*pagetitle]]">
<meta itemprop="description" content="[[*description]]">
<meta itemprop="image" content="">
<!-- Twitter -->
@dubrod
dubrod / 2013 Adaptive CSS Containers
Last active Dec 15, 2018
2013 Adaptive CSS Containers Snippet. From 1600+ to Mobile. This snippet will keep a nice margin on the sides of your container for browser size most used in 2012. It's not a Responsive Snippet, that would be using %.
View 2013 Adaptive CSS Containers
/*~~~~ CONTAINERS December 2013 - http://www.w3counter.com/globalstats.php ~~~~*/
/* 1600x900 4.09% */
.container{
margin: 0 auto;
padding:0;
height:auto;
width:1410px; /* 3 Columns would be 470px */
}
/* 1440x900 5.26% */
@media (max-width: 1440px){ .container{width: 1230px; /* 3 Columns would be 410px */ } }
@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');
@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>
//////
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,
You can’t perform that action at this time.