Skip to content

Instantly share code, notes, and snippets.

View silentworks's full-sized avatar

Andrew Smith silentworks

View GitHub Profile
<?php
$file = $modx->getOption('base_path') . 'facebook.php';
if (file_exists($file)) {
require_once $file;
}
@silentworks
silentworks / _instructions.md
Created November 13, 2012 11:59 — forked from dhrrgn/_instructions.md
A Sublime Text 2 Project file for Fuel

Sublime Text 2 Fuel Project File

Description

This sets up your Sublime Text 2 Fuel project so that your tab and line ending settings are all correct. This way if you like spaces or something, you can still use them by default.

Usage

  1. Create a file named fuel.sublime-project in your Fuel root directory (not the web root).
  2. Open with Sublime Text 2
@silentworks
silentworks / gist:4159644
Created November 28, 2012 07:34
Twig in MODX
## Base Template
<html>
<head>
<title>{{ site_name }} - {{ pagetitle }}</title>
<base href="{{ site_url }}" />
</head>
<body>
<ul>
{% for page in getPages() %}
<li>{{ page.pagetitle }} - ({{ page.tv.testTV }})</li>
@silentworks
silentworks / modMigrate.php
Created November 28, 2012 10:24 — forked from alanpich/modMigrate.php
modMigrate ideas
<?php
abstract class pmsMigrateObject {
/* @var object Object Properties */
private $data;
/* @var string MODx Class Name */
private $classKey;
@silentworks
silentworks / common.php
Created January 23, 2013 10:23
Resource already exist
function aliasExists($pageId, $parent = null){
$modx = modX::getInstance();
$c = $modx->newQuery('modResource');
$c->where(array('alias' => $pageId));
if ($parent) {
$c->andCondition(array('parent' => $parent));
}
$count = $modx->getCount('modResource', $c);
@silentworks
silentworks / gist:5058812
Last active December 14, 2015 08:38
This is how you could return your processor with specific system settings.
<?php
class MyGetListProcessor extends modObjectGetProcessor {
public $classKey = 'className';
public function process() {
$data = array();
$settings = array(
'emailsender' => $this->modx->getOption('emailsender')
);
$data['total'] = count($settings);
@silentworks
silentworks / button.js
Last active December 14, 2015 12:49
Creating buttons in ExtJS to use in MODX
Careers.button.btnRenderer = function (v, config) {
var config = config || { bodyStyle: '', holderStyle: 'float:left', style: {} };
var id = Ext.id();
(function() {
var btn = new Ext.Button({
renderTo: id
,text: config.text
,bodyStyle: config.bodyStyle
,style: config.style
<div id="content" ng-controller="AppCtrl">
<div id="toolbar">
<div id="search"><label for="s">Search:</label> <input id="s" type="text" ng-model="searchText"></div>
</div>
<ul>
{literal}
<li ng-repeat="theme in themes.set | filter:searchText" ng-class="{active: currentTheme == theme.slug}">
<div class="theme">
<div class="top">
<div class="wrapper">
## Current data
[
{
"id": 1,
"caption": "My Latest",
"filename": "2010-11-30 13.13.39.jpg",
"display": 1,
"created_at": "0000-00-00 00:00:00",
"updated_at": "0000-00-00 00:00:00"
}
@silentworks
silentworks / gist:5204211
Created March 20, 2013 12:13
Including CSS and JS in any page to head and before body tag
<?php
/*
* Register CSS and JS to load in head of website
*/
$link = $modx->getOption('link', $scriptProperties, '');
if (empty($link)) {
return false;
}