Skip to content

Instantly share code, notes, and snippets.

View Patrick64's full-sized avatar
🦆
All good!

Patrick Woodcock Patrick64

🦆
All good!
View GitHub Profile
@Patrick64
Patrick64 / submit_form_to_new_window.js
Created June 27, 2011 15:47
JQuery: Include this javascript in your page so when the user submits a form their browser opens a new window with the form contents in the querystring.
//open a new window with form fields put in querystring, rather than submit form
$('document').ready(function() {
$('form').submit(function() {
var url = $(this).attr('action') + '?' + $(this).serialize();
window.open(url);
return false; // dont submit form
});
});
@Patrick64
Patrick64 / reefine-filter-events-by-month.html
Last active December 30, 2015 22:09
Reefine filter events by month
{exp:reefine
channel="event"
filter:type:category_group="1"
filter:type:join="none"
filter:month:type="month_list"
filter:month:fields="event_from|event_to"
filter:month:join="none"
filter:month:where_after="{current_time}"
parse="inward"
url="/{segment_1}/{type}/{month}"
@Patrick64
Patrick64 / Reefine-hello-world.html
Created December 10, 2013 15:56
Clothes shop example for Reefine
{exp:reefine channel="clothes" parse="inward" theme="shop"
filter:fields="title|product_type|size|colour|price"
filter:price:type="number_range"
url="/{segment_1}/{segment_2}/{product_type}/{size}/{colour}/{price}/{title}"}
{entries}
{if entry_ids=='-1'} <p>No matching products found.</p> {/if}
{exp:channel:entries entry_id="{entry_ids}"
disable="categories|category_fields|member_data" dynamic="no"
orderby="title" sort="asc" status="not closed" limit="8"
paginate="yes"}
@Patrick64
Patrick64 / reefine-flexible-filter-groups-example.html
Created December 11, 2013 09:21
Complete example using flexible filter groups This example uses the {number_range_groups} {list_groups} {search_groups} variable pairs and selects the correct html based on the group type. You can add extra fields to this example and they should show up automatically.
{exp:reefine filter:search:fields="title|product_type|colour"
filter:search:type="search" filter:price:fields="price"
filter:price:type="number_range"
filter:fields="product_type|size|colour" channel="clothes"
parse="inward"
url="/{segment_1}/{segment_2}/{product_type}/{size}/{colour}/{price}/{search}/#reefine"
}
<div class="reefine" id="reefine">
<div role="search">
<div class="reefine_search">
@Patrick64
Patrick64 / reefine-seperate-filters-example.html
Created December 11, 2013 09:28
Complete example using separate filters. This example outputs each filter group in a separate tag pair rather than using the {list_groups}, {number_groups} etc. This is useful for customising the order, position and formatting of different filters.
<div class="reefine" id="reefine">
{exp:reefine filter:search:fields="title|product_type|colour"
filter:search:type="search" filter:price:fields="price"
filter:price:type="number_range"
filter:fields="product_type|size|colour|store_availability"
channel="clothes" parse="inward"
url="/{segment_1}/{segment_2}/{product_type}/{size}/{colour}/{store_availability}/{price}/{search}/#reefine"
seperate_filters="yes" }
<div class="reefine_search">
{search} {filters}
@Patrick64
Patrick64 / reefine-number-range-links
Created January 24, 2014 15:26
Example of using a list of links instead of textboxes for the number range
@Patrick64
Patrick64 / reefine_tree_groups_example.html
Created September 28, 2015 08:10
Example of tree groups in reefine taken from shop theme
{tree_groups}
<div class="reefine_tree">
<h3 class="group_{group_name}">{label}</h3>
<ul>
{filters}
<li class="{filter_active_class} filter-id-{filter_id} {has_active_subfilters_class}">
<a href="{url}" aria-selected="{filter_active_boolean}" rel="nofollow">{filter_title} ({filter_quantity})</a>
{subfilters_1}
<ul>
{filters_1}
@Patrick64
Patrick64 / image_bg_css.html
Last active November 28, 2018 15:29
Tempalte snippet for making a response image background to minimise download size using CE Image. #eecms
{!--
Template snippet image_bg_css.html
This tempalte snippet is for making a response image background to minimise download size using CE Image.
Usage:
{embed="include/image_bg_css" class="div-class" src="{image_url}" max="800"}
^ ^ ^ ^
| | | |
location of this template Class of div URL of image Max image size
@Patrick64
Patrick64 / response_image.html
Created December 11, 2018 09:33
response_image.html #eecms ce_image
{!--
Template snippet
This tempalte snippet is for making a response image to minimise download size using CE Image.
Usage:
{embed="include/responsive_image" class="div-class" src="{image_url}"}
^ ^ ^
| | |
/**
* Set font size so the text fits the width of the container
*/
function setupTitleTextFill(container, textElement) {
// make element inline block and wrap a div so it still does a line break
$(container + " " + textElement).css("display","inline-block").wrap('<div class="title-text-fill-wrapper"></div>');
resizeTitleTextFill(container, textElement);
$(window).resize(function() {
resizeTitleTextFill(container, textElement);