Skip to content

Instantly share code, notes, and snippets.

View zaigham's full-sized avatar
🌏

Zaigham R. zaigham

🌏
View GitHub Profile
@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 / 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
<?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'];
/** <?php
* getReqParam
*
* Copyright 2010 by Shaun McCormick <shaun@collabpad.com>
*
* 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
*
* 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
global $modx;
$doc = $modx->getDocument($id);
$output = '';
if(!empty($doc))
$output = "<a title='".$doc[' pagetitle']."' href='".$modx->makeUrl($id, '', '',
'full')."'>".$doc['pagetitle']."</a>";