Skip to content

Instantly share code, notes, and snippets.

  • MODX_BASE_PATH -- path to the MODX root

  • MODX_CORE_PATH -- path the MODX core directory

  • MODX_ASSETS_PATH -- path to the MODX assets directory

  • MODX_MANAGER_PATH -- path to the MODX manager directory

  • MODX_CONNECTORS_PATH -- path to the connectors directory

  • MODX_PROCESSORS_PATH -- path to the processors directory

  • [[++core_path]]

  • [[++manager_path]]

  • [[++assets_url]]

@pepebe
pepebe / youtube-stuff.md
Last active December 10, 2018 14:05
youtube stuff

!less tracking: //www.youtube-nocookie.com/embed/[[+value]]

!thumbnails

Each YouTube video has 4 generated images. They are predictably formatted as follows:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
https://img.youtube.com/vi//2.jpg
@pepebe
pepebe / getFormSteps.php
Created December 5, 2018 15:11 — forked from jonleverrier/getFormSteps.snippet.php
getFormSteps for the MODX Formalicious form builder by Sterc. This utility snippet displays all the step titles for a given form ID.
<?php
/*
getFormSteps snippet
for the Formalicious form builder for MODX by Sterc
This utility snippet displays all the step titles for a given form ID
Put the snippet in the Formalcious steps tpl and call like this;
[[!getFormSteps? stepFormId=`[[!+form_id]]` &tpl=`myFormStepsTpl`]]
@pepebe
pepebe / collections.imageRenderer.php
Last active July 14, 2023 18:32
Collections - Snippetrenderer for images. Supports Media Source
<?php
// Collections Snippet Renderer
// Version: 0.1
// 2do: autoimatically retrieve assets path from media source
$row = $modx->getOption('row', $scriptProperties, '');
$value = $modx->getOption('value', $scriptProperties, '');
$column = $modx->getOption('column', $scriptProperties, '');
$imgName = $value;
@pepebe
pepebe / responsive-tables.php
Last active October 4, 2018 07:52
Responsive bootstrap tables for modx - Wraps tables into a div.table-responsive container and adds a custom class to the table tag
<?php
/*
responsive-tables.php for modx
Wraps tables into a div.table-responsive container and adds a custom class to the table tag
This technique is used by bootstrap 3.3.7 and 4.1:
http://getbootstrap.com/docs/4.1/content/tables/#responsive-tables
Turns:
<table>...</table>
@pepebe
pepebe / default.txt
Created September 21, 2018 10:04
ContentBlocks Default Colors
#ffffff,#000000,#8c191d,#eeece1,#1f497d,#4f81bd,#c0504d,#9bbb59,#8064a2,#4bacc6,#f79646,#ffff00,#f2f2f2,#7f7f7f,#ddd9c3,#c6d9f0,#dbe5f1,#f2dcdb,#ebf1dd,#e5e0ec,#dbeef3,#fdeada,#fff2ca,#d8d8d8,#595959,#c4bd97,#8db3e2,#b8cce4,#e5b9b7,#d7e3bc,#ccc1d9,#b7dde8,#fbd5b5,#ffe694,#bfbfbf,#3f3f3f,#938953,#548dd4,#95b3d7,#d99694,#c3d69b,#b2a2c7,#b7dde8,#fac08f,#f2c314,#a5a5a5,#262626,#494429,#17365d,#366092,#953734,#76923c,#5f497a,#92cddc,#e36c09,#c09100,#7f7f7f,#0c0c0c,#1d1b10,#0f243e,#244061,#632423,#4f6128,#3f3151,#31859b,#974806,#7f6000
@pepebe
pepebe / collections.imageplus.js
Created September 16, 2018 10:36 — forked from jenswittmann/collections.imageplus.js
Custom MODX Collections renderer for Image+ with cropping
collections.renderer.imageplus = function(value, metaData, record, rowIndex, colIndex, store) {
if (value != '' && value != null) {
var data = Ext.decode(value);
var url = MODx.config.connectors_url + 'system/phpthumb.php?imageplus=1';
var params = {};
params.src = 'upload/'+MODx.config['collections.renderer_image_path'] + data.sourceImg.src;
params.w = 100;
if (data.sourceImg.src.indexOf('.png') !== -1) {
params.f = 'png';
@pepebe
pepebe / chmod.md
Last active August 19, 2018 12:28
Useful terminal commands (ongoing list)

set permissions

Source: https://stackoverflow.com/a/11512211

To change all the directories to 755 (drwxr-xr-x):

find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
find . -type d -exec chmod 755 {} \;
<?php
// by Bruno17 on slack
// Example: rgba([[+tv.node_activecolor:hextorgb]], 0.5)
$hexStr = $input;
$returnAsString = true;
$seperator = ',';
$hexStr = preg_replace("/[^0-9A-Fa-f]/", '', $hexStr); // Gets a proper hex string
$rgbArray = array();
@pepebe
pepebe / 01-introduction.md
Last active February 2, 2022 10:27
Collections Editors Complete List

1 Introduction

Collections is a handy tool to display the child resources of a parent inside a configurable grid. Each column can get its own configurable editor so you can edit a resource right from the grid.

image Example for a datatime editor

Editors can be attached by editing the collections column settings:

image