This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A simple function that uses mtime to delete files older than a given age (in seconds) | |
* Very handy to rotate backup or log files, for example... | |
* | |
* $dir String whhere the files are | |
* $max_age Int in seconds | |
* return String[] the list of deleted files | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TimeEncryptor: | |
<?php | |
$encryptedValue = base64_encode(time()); | |
return $encryptedValue; | |
SpamKiller: | |
<?php | |
/* | |
Custom Spam Killer Functions | |
used in conjuction with <input type="hidden" name="formitTimeEncryptor" value="[[!TimeEncryptor]]" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-Type:application/json"); | |
$id = $_GET["id"]; | |
if(empty($id)){ die(); } | |
$obj = $modx->getObject('modResource', $id); | |
$output = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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','[email protected]'); | |
//$modx->mail->address('reply-to','[email protected]'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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=`[email protected]` | |
&emailUseFieldForSubject=`1` | |
&redirectTo=`33` | |
&validate=`name:required, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GetParentAlias | |
$output = ''; | |
/* Get the current resource's 'parent' field */ | |
$parentId = $modx->resource->get('parent'); | |
/* Get the parent object */ | |
$parentObj = $modx->getObject('modResource', $parentId); | |
NewerOlder