Skip to content

Instantly share code, notes, and snippets.

View jacmaes's full-sized avatar

Jacques Maes jacmaes

View GitHub Profile
@jacmaes
jacmaes / new_gist_file.php
Created December 1, 2013 19:09
Select the nth child of a page.
$c = $page->children->eq(1);
@jacmaes
jacmaes / search-form
Created December 6, 2013 13:42
Advanced search form with FormBuilder
http://processwire.com/talk/topic/1938-building-an-advanced-search-form-with-form-builder/?p=18151
// http://processwire.com/talk/topic/1938-building-an-advanced-search-form-with-form-builder/?p=36295
<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
@jacmaes
jacmaes / search-processor.php
Last active December 6, 2018 14:56 — forked from outflux3/search-processor.php
Search #pw
<?php
// http://processwire.com/talk/topic/1938-building-an-advanced-search-form-with-form-builder/?p=36295
// check if there are GET variables present in the URL
if(count($input->get)) {
$selector = '';
if($input->get->application) {
if($input->post->step == 1) {
// process step 1 form and display step 2 form
$email = $sanitizer->email($input->post->email);
$session->email = $email;
echo "
<form method='post' action='./'>
<input type='text' name='fullname' placeholder='your full name'>
<input type='hidden' name='step' value='2'>
<?php
/**
* collect all tags
* ======================================
*/
$alltags = array(); // container
$use_urlsegments = false;
<?php
// ------------------------------ FORM Processing ---------------------------------------
$errors = null;
$success = false;
// helper function to format form errors
function showError($e){
return "<p class='error'>$e</p>";
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Enquire Test</title>
<meta name="viewport" content="width=device-width">
<!-- Normalize CSS -->
<link rel="stylesheet" src="http://normalize-css.googlecode.com/svn/trunk/normalize.css"/>
<!-- Bootstrap CSS -->
@jacmaes
jacmaes / from.php
Last active August 29, 2015 14:08 — forked from somatonic/from.php
<?php
// get a page
$editpage = $pages->get("/editme/");
$ignorefields = array("isOld","language_published");
$form = $modules->get("InputfieldForm");
$form->method = 'post';
$form->action = './';
<?php
/**
* This module is build by Adrian, tnx Adrian.
*
*
* Module to hide pages that are not editable by the logged in user.
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer