Skip to content

Instantly share code, notes, and snippets.

@patrickatwsrn
patrickatwsrn / modx.memberpages.md
Created July 31, 2022 14:01
Notes on setting up different login ideas for members

Notes on setting up different login ideas for members

Important This is work in progress and FAR away from completed.

Ideas:

  • Login webhook that sends a message to a slack message board.

MODX Extras

  • Login by jako: Loads a simple login/logout form, with password retrieval functionality and a register form snippet.
  • Auth0 by sepiariver - Log in to MODX using any/all of the Identify Providers (IdPs) supported by Auth0, such as Google, Facebook, Twitter, Github, Microsoft, Dropbox, and dozens of others, including enterprise services
@patrickatwsrn
patrickatwsrn / modx.multi-context.md
Last active July 31, 2022 14:09
Notes on setting up a multi context modx page

Notes on setting up a multi context modx page

Important This is work in progress and FAR away from completed.

Scenario one: Multiple subdomains

Use case:

I want to have two contexts:

  • Homepage: resources handling actual content
  • Static: resources handling static content like css, js, layout images.
@patrickatwsrn
patrickatwsrn / modx-setup.md
Last active November 27, 2025 14:18
Basic MODx setup (German localization)

Introduction

My personal notes for an opinionated MODX setup.

What is MODX?

MODX is an honest down to earth CMS with a whole lot of freedom.

Install MODX

MODX should run on most decent servers.

Procedure

@patrickatwsrn
patrickatwsrn / gist:2c174a724a76f1c209109074531abe5b
Created May 13, 2022 07:15 — forked from mythicallage/gist:4514994
MODx Revo snippet. This a snippet is generator a list of possible values ​​from a list of existing values by ​​tv name.
<?php
/*[[newGetTvList? &tvname=`articlestags`]]
* Аналогично:
*@EVAL return $modx->runSnippet('GetTvList',array('tvname'=>'articlestags'));
*
*
*Убирает все пробелы, заменяет ','=>'||'
*Сниппет получает все значения ТВ по tv.name и формирует в список возможных значений
*для tv Множественный выбор, Одиночный выбор.
*/
@patrickatwsrn
patrickatwsrn / MODX plugn. Save Chunks and Snippets to the external files MODX Revolution Plugin that saves all your Chunks and Snippets to the external files (in category folders) right in the Root directory. Save the plugin, go to "System Events", check "On Manager Cache Update", Refresh cache from Dashboard, Disable Plugin.
<?php
$chunks = $modx->getCollection('modChunk');
$snippets = $modx->getCollection('modSnippet');
foreach ($chunks as $chunk) {
$content = $chunk->getContent();
$category = "SELECT category FROM `modx_categories` WHERE id = " . $chunk->get('category') . "";
@patrickatwsrn
patrickatwsrn / result.js
Created May 4, 2022 16:21 — forked from larscwallin/result.js
XPDO to simple ExtJS 3 Stores
var SimplxStudio = {};
SimplxStudio.modx = {};
/* Creating JSON representation for modAccess */
SimplxStudio.modx.modAccess={
"class": "modAccess",
"extends":"xPDOSimpleObject",
"fields": [
"id","alias","target","principal_class","principal","authority","policy"
@patrickatwsrn
patrickatwsrn / WebHook.php
Created November 27, 2021 19:27 — forked from bwente/WebHook.php
Very basic webhook for MODX, posts JSON to a URL. Works well with Zapier.
<?php
// [[!WebHook? &secret=`dh730>soteW` &runsnippet=`updateSettings` &params=`setting=savings`]]
$mySecret = $modx->getOption('secret', $scriptProperties);
$mySnippet = $modx->getOption('runsnippet', $scriptProperties);
$myParams = $modx->getOption('params', $scriptProperties);
$achunks = array_chunk(preg_split('/(=|,)/', $myParams), 2);
$myParams = array_combine(array_column($achunks, 0), array_column($achunks, 1));
$webhookContent = "";
@patrickatwsrn
patrickatwsrn / curl.with.cookie.php
Created November 15, 2021 14:27 — forked from nazt/curl.with.cookie.php
curl.with.cookie.php
@patrickatwsrn
patrickatwsrn / multicolumn.js
Last active July 19, 2021 13:25
Display children of element in multiple columns if the number of children is equal to or higher than a certain number.
const multiColumns = document.querySelectorAll('.multiColumn');
if(multiColumns.length > 0){
multiColumns.forEach(multiColumn => {
/* options may be changed by data-atributes */
var columnCount = multiColumn.getAttribute('data-column-count') ? multiColumn.getAttribute('data-column-count') : 2;
var columnGap = multiColumn.getAttribute('data-column.gap') ? multiColumn.getAttribute('data-column.gap') : '4rem';
/* don't change anything below this point */