Skip to content

Instantly share code, notes, and snippets.

// 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;
}
@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>";
}
@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,
<?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 / 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>
@alanfluff
alanfluff / aria.html
Created March 20, 2013 18:34
[HTML CSS Accessibility] ARIA roles
HTML
---
<div role="navigation">
CSS
---
div[role="navigation"] {
your styles here
}
@alanfluff
alanfluff / gist:5224780
Created March 22, 2013 21:11
[CSS jQuery] Image treatment
============================================THE CSS============================================
/* - - - - -fD
Images - jQ treamtent
By default, all images are processed by the jQ, optional classes are:
noAuto (stops jQ and CSS processing the img)
left
middle
right
2013-04-09-0817
@alanfluff
alanfluff / gist:5224792
Created March 22, 2013 21:12
[jQuery] Boilerplate empty jQ starter
$(document).ready(function() {
});
<?php
// check if there are GET variables present in the URL
if(count($input->get)) {
$selector = '';
if($input->get->application) {
$application = $sanitizer->pageName($input->get->application);
$appid = $pages->get("template=product-options, name=$application");
<form name='search' id='product-search' method='get' action='<?php echo $config->urls->root?>speaker-finder/'>
<ul id="row1">
<li>
<label for='search_app'>Application</label>
<select id='search_app' name='application' onchange="$(this.form).trigger('submit')">
<option value=''>Any</option><?php
// generate the application options, checking the whitelist to see if any are already selected
foreach($pages->get(1016)->children('include=all') as $app) {
$selected = $app->name == $input->whitelist->application ? " selected='selected' " : '';