Skip to content

Instantly share code, notes, and snippets.

View zaigham's full-sized avatar
🌏

Zaigham R. zaigham

🌏
View GitHub Profile
global $modx;
$doc = $modx->getDocument($id);
$output = '';
if(!empty($doc))
$output = "<a title='".$doc[' pagetitle']."' href='".$modx->makeUrl($id, '', '',
'full')."'>".$doc['pagetitle']."</a>";
/** <?php
*
* getUrlParam
*
* A simple snippet to return a value passed through a URL parameter.
*
* @ author Paul Merchant
* @ copyright 2010 Paul Merchant
* @ version 1.0.0 - October 15, 2010
* @ MIT License
/** <?php
* getReqParam
*
* Copyright 2010 by Shaun McCormick <[email protected]>
*
* getReqParam is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
<?php
/* Virtual aliases
* Patrick Nijkamp
* http://www.1-vision.nl
* When installed create a property in the DEFAULT property set called "tvID"
* and fill it with the ID of the TV that hold's the old URL.
* Old URL's without '/' at the start.
*/
$aliasTvId = $scriptProperties['tvId'];
@zaigham
zaigham / domain.snippet.php
Created October 13, 2011 10:10
[[domain]] snippet for MODX Revolution
<?php
// Forget the snippet, use the following placeholder:
// [[++http_host]]
// Thanks to @curiositymind @mark_hamstra
@zaigham
zaigham / redirect.snippet.php
Created October 25, 2011 01:33
A redirect Snippet
<?php
// Usage: [[redirect? &id=`123`]]
$url = $modx->makeUrl($id);
return $modx->sendRedirect($url);
?>
@zaigham
zaigham / gist:1377387
Created November 18, 2011 18:53
My Journey to Learn SIMPLX Widgeteer
<h2>Something should show up down there</h2>
[[!simplx_widgeteer?
&dataSetUrl=`http://modxclub.com/rss-feed`
&useChunkMatching=`true`
&preprocessor=`widgeteer_preprocessor_xml2json`
&chunkPrefix=`modx.feed.tpl_`
]]
<hr/>
@zaigham
zaigham / microdata.modx.html
Created November 30, 2011 12:22
microdata.modx.html
<link rel="canonical" href="[[~[[*id]]? &scheme=`full`]]" />
<meta property="og:image" content="[[++site_url]]pt/phpThumb.php?src=/[[*siteThumb]]&amp;w=90&amp;h=90&amp;q=80&amp;zc=T"/>
<meta property="og:site_name" content="[[++site_name:htmlent]]"/>
<meta property="og:title" content="[[*pagetitle]]"/>
<meta property="og:url" content="[[++site_url]][[~[[*id]]]]"/>
<meta property="og:type" content="article"/>
<meta itemprop="name" content="[[*pagetitle]]">
<meta itemprop="description" content="[[*siteDescription:word_limit=`70`]]">
<meta itemprop="image" content="[[++site_url]]pt/phpThumb.php?src=/[[*siteThumb]]&amp;w=90&amp;h=90&amp;q=80&amp;zc=T">
<?php
/*echo '<pre>';
print_r($_GET);
echo '</pre>';*/
if (empty($_GET['api'])) {
return 'Empty Request. No data saved.';
}
else {
$db_water_flow = filter_var($_GET[waterFlow], FILTER_SANITIZE_STRING);
$total-columns : 24; // a 24-column grid
$column-width : 1.875em; // each column is 30px wide
$grid-padding : 0.313em; // 5px grid-padding
$gutter-width : $grid-padding*2; // 5*2px gutters between columns
$desktop : 24;
$tablet : 16 (($column-width*16)+($gutter-width*15))em;
$mobile : 8 (($column-width*8)+($gutter-width*7))em;