Skip to content

Instantly share code, notes, and snippets.

View chrisdempsey's full-sized avatar

Chris Dempsey chrisdempsey

View GitHub Profile
@gibbs
gibbs / clear_modx_cache_2.0.php
Created October 27, 2013 13:44
Refresh / clear the MODx Revolution (2.0.*) cache
<?php
/*
* Clear (refresh) MODx Cache from external PHP Script
*
* MODx Revolution (2.0.7-pl)
* Daniel Gibbs
*/
// Path to MODx Core Directory
define("MODX_CORE_PATH", "../core/");
@Flygenring
Flygenring / toResourceField.snippet.php
Last active March 28, 2022 21:47
MODX Snippet to get a field from a resource based on a supplied resource id, meant to be used as an output filter.
<?php
/**
* Gets a field from a resource based on a supplied resource id, meant to be used as an output filter.
*
* Based on a resource ID a field can be retrieved. This can be standard fields as 'pagetitle' or 'alias',
* but a few custom fields are also available; 'siblingNextId', 'childrenFirstId', and 'childrenCount'.
* Only resources that are not marked as 'deleted' or 'hidemenu', and that is marked as 'published' are returned.
* Examples:
* [[*id:toResourceField]] => returns the resource pagetitle
* [[*id:toResourceField=`alias`]] => returns the resource alias
@christianhanvey
christianhanvey / MODX caching.md
Last active June 14, 2017 11:26
Some links on caching for MODX

If you are using git, so you can take advantage of static elements within MODX, you will need to be aware that simply updating your files does not mean MODX will pick that up. It will pick up changes in a file IF you the element is being called uncached.

http://forums.modx.com/forums/thread/73346/static-resources-don-t-update-without-cache-clear http://forums.modx.com/thread/73002/static-sources-caching-and-setup

This is not a big deal while working on a development site, performance is not your initial priority at that point. But when you get to deploying, you'll need to know that updating a file will not necessarily update how your site runs, and you don't want to be clearing your entire site cache. A big site would be taking a heavy server hit as its visitors trigger all pages regenerating their cache...

For an overview of MODX caching strategy, start at the documentation (of course) if you havn't already:

@chrisl8888
chrisl8888 / drupal-views-share-global-text-field
Last active April 23, 2024 04:07
share url's for facebook, twitter, pinterest with just get variables
<ul>
<li class="share-text">Share this>/li>
<li class="share-tw"><a href="http://twitter.com/share?text=[title]"><span></span></a></li>
<li class="share-fb"><a href="http://www.facebook.com/sharer.php?u=/node/[nid]&p=[title]"><span></span></a></li>
<li class="share-pinterest"><a href="http://pinterest.com/pin/create/button/?url=/node/[nid]&description=[title]"><span></span></a></li>
</ul>
@atk
atk / ie10hack.css
Created November 6, 2012 14:43
IE10 hack
/*
#ie10 will only be red in MSIE 10,
both in high contrast (display setting) and default mode
*/
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
#ie10 { color: red; }
}
@fomigo
fomigo / modx-snippets.php
Created October 9, 2012 12:03 — forked from christianhanvey/modx-snippets.php
Useful snippets for MODX Revo
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
@nobuti
nobuti / gist:3816985
Created October 2, 2012 07:11
MySQL tables for continent names, country names and their ISO codes
CREATE TABLE IF NOT EXISTS `continents` (
`code` CHAR(2) NOT NULL COMMENT 'Continent code',
`name` VARCHAR(255),
PRIMARY KEY (`code`)
) ENGINE=InnoDB;
INSERT INTO `continents` VALUES
('AF', 'Africa'),
('AS', 'Asia'),
('EU', 'Europe'),
@christianhanvey
christianhanvey / links
Created July 24, 2012 00:17
some useful reference links - in markdown
@krismas
krismas / argv.php
Last active August 3, 2019 16:37
A small MODX snippet to extract POST, GET, SESSION & COOKIE values
<?php
/*
* A small MODX snippet to extract POST, GET, SESSION & COOKIE values - (c) 2012-2016 ackwa.fr
*
* @version : 1.0.4
* @see : https://gist.github.com/gists/2853625
* @name : argv.php
* @author : [email protected]
* @usage : [[!argv?key=`myparam`&default=`1`]] -> return the value
* [[!argv?key=`myparam`&default=`1`&toph=`1`]] -> set [[+argv.myparam]]
@christianhanvey
christianhanvey / modx-snippets.php
Last active December 8, 2024 18:46
Useful snippets for MODX Revo
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php