Skip to content

Instantly share code, notes, and snippets.

View zaigham's full-sized avatar
🌏

Zaigham R. zaigham

🌏
View GitHub Profile
protected void Page_PreRender(object sender, EventArgs e)
{
int temp = Convert.ToInt32(leftnav.Count);
if (count == 0 && Convert.ToInt32(leftnav.Count) == 0)
{
contentright.Attributes["class"] = "center-part";
}
else if (count == 0 && Convert.ToInt32(leftnav.Count) != 0)
@zaigham
zaigham / gist:c639c61b8b60c16f37fe
Created October 17, 2014 17:53
modDevTools download error log
[2014-10-17 22:42:56] (ERROR @ C:\Ampps\...\core\model\modx\transport\modtransportprovider.class.php : 232) PHP warning: array_merge(): Argument #1 is not an array
[2014-10-17 22:42:56] (ERROR @ C:\Ampps\...\core\model\modx\transport\modtransportprovider.class.php : 357) Recoverable error: Argument 2 passed to modTransportProvider::arg() must be of the type array, null given, called in C:\Ampps\...\core\model\modx\transport\modtransportprovider.class.php on line 232 and defined
[2014-10-17 22:42:56] (ERROR @ C:\Ampps\...\core\model\modx\transport\modtransportprovider.class.php : 365) Recoverable error: Argument 1 passed to modTransportProvider::args() must be of the type array, null given, called in C:\Ampps\...\core\model\modx\transport\modtransportprovider.class.php on line 359 and defined
[2014-10-17 22:42:56] (ERROR @ C:\Ampps\...\core\model\modx\transport\modtransportprovider.class.php : 379) PHP warning: array_merge(): Argument #2 is not an array
[2014-10-17 22:42:56] (ERROR @ C:\Ampps\...\core\model\mo
<?php
/**
* SessionManager
* A script that can be used for easy control over your session variables.
* Put this script in your core/components/ folder, inside a sessionman/ subdirectory.
*
* Load this one in your snippets/plugins like;
*
* $sessman = $modx->getService('session','SessionManager', $modx->getOption('sessman.core_path',null,$modx->getOption('core_path').'components/sessionman/'), $scriptProperties);
* if(!($sessman instanceof SessionManager)) { $modx->log(modX::LOG_LEVEL_ERROR, 'Session manager could not be loaded..'); return ''; }
@zaigham
zaigham / versionx-hhvm.txt
Last active August 29, 2015 14:21
versionx-install-hhvm-error
Below is the error I could catch... in /var/log/hhvm/error.log
The Manager CMP for VersionX are installed and working fine. but new tables are not created.
===========================
\nFatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S02] [1146] Table 'modx23xhhvm.modx_versionx_resource' doesn't exist' in :\nStack trace:\n#0 /home/vagrant/modx/23x/core/xpdo/xpdo.class.php(2500): PDO->query()\n#1 /home/vagrant/modx/23x/core/xpdo/om/mysql/xpdomanager.class.php(131): xPDO->query()\n#2 /home/vagrant/modx/23x/core/packages/versionx-2.1.2-pl/modCategory/c7c31abcbb1216d62f8deff18301a6d9.tables.resolver.resolver(40): xPDOManager_mysql->createObjectContainer()\n#3 /home/vagrant/modx/23x/core/xpdo/transport/xpdovehicle.class.php(226): include()\n#4 /home/vagrant/modx/23x/core/xpdo/transport/xpdoobjectvehicle.class.php(227): xPDOVehicle->resolve()\n#5 /home/vagrant/modx/23x/core/xpdo/transport/xpdoobjectvehicle.class.php(88): xPDOObjectVehicle->_installObject()\n#6 /home/vagrant/modx/23x/core/
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 <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
/* 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);
?>