Skip to content

Instantly share code, notes, and snippets.

@alanfluff
alanfluff / ProcessWire: PHP: Picturefill markup
Created February 27, 2013 11:57
Picturefill markup with ProcessWire image sizing
/*
From Marty Walker Pastie
Picturefill markup with ProcessWire image sizing
https://github.com/scottjehl/picturefill/
http://processwire.com/
*/
<div data-picture data-alt='{$page->title}'>
<div data-src='{$image->size(50,0)->url}'></div>
<?php
//This just blew my mind
//
//User has field 'userPages'[Pagefield type], where administrator added parts of whole tree avail. to user.
//This checks whether current page (wrapped in object) or any of its parents was added to this 'userPages'
//(thus current page or anything higher in the hierarchy gives user the access)
//wow.
$access =
count(
@alanfluff
alanfluff / Snippet: JQuery: Yellow fade effect.js
Last active January 9, 2018 09:46
Yellow fade effect with JQuery - Stack Overflow
jQuery.fn.highlight = function () {
$(this).each(function () {
var el = $(this);
$("<div/>")
.width(el.outerWidth())
.height(el.outerHeight())
.css({
"position": "absolute",
"left": el.offset().left,
"top": el.offset().top,
@alanfluff
alanfluff / gist:2776392
Created May 23, 2012 17:03
Visible test
if($page->parent->isHidden()) {
foreach($page->parents as $parent)
if($parent->viewable()) echo "<li><a href='{$parent->url}'>{$parent->title}</a></li>";
}
// above opening HTML tag
function flourish_loader( $class_name )
{
// Customize this to your root Flourish directory
$flourish_root = wire('config')->paths->root . 'site/.flourish/';
$file = $flourish_root . $class_name . '.php';
if (file_exists($file)) {
include $file;
}