Skip to content

Instantly share code, notes, and snippets.

<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' " : '';
<?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");
@mr-fan
mr-fan / pwcssjs
Created June 22, 2014 09:45
Individual CSS and JS for Processwire trick from Ryan
<head>
<!-- all your typical <head> stuff -->
<?php
$file = "styles/$page->template.css";
if(is_file($config->paths->templates . $file)) {
echo "<link rel='stylesheet' type='text/css' href='{$config->urls->templates}$file' />";
}
@mr-fan
mr-fan / Sample HTML Elements
Created June 17, 2014 15:04
Sample HTML Elements
<!-- Sample Content to Plugin to Template -->
<h1>CSS Basic Elements</h1>
<p>The purpose of this HTML is to help determine what default settings are with CSS and to make sure that all possible HTML Elements are included in this HTML so as to not miss any possible Elements when designing a site.</p>
<hr />
<h1 id="headings">Headings</h1>
<h1>Heading 1</h1>
// 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
<form action="/customer-service/contact/contact-success/" method="post">
<p><label for="contactname">Name:</label></p>
<p><input type="text" name="contactname"></p>
<p><label for="email">E-Mail:</label></p>
<p><input type="email" name="email"></p>
<p><label for="comments">Comments:</label></p>
<p><textarea name="comments" cols="25" rows="6"></textarea></p>
<button type="submit">Submit</button>
</form>
<?php
// Let's assume the pages in question are named like Blah1, Blah2, etc.
foreach ($pages->find('name^=Blah') as $blahPage) {
// Let's assume the fields that need to contain HTML are called Html1, etc.
foreach ($blahPage->fields->find('name^=Html') as $field) {
// Let's assume these fields have their value in ShouldBeHtml
$fieldContent = $field->ShouldBeHtml;
$contentWrapped = '';
// Parse the field's content as HTML
@mr-fan
mr-fan / Simple Pagination
Last active August 29, 2015 14:02 — forked from dewwwald/_A.md
##Simple Pagination For Processwire
###ProcessWire Requirements
On the template you want pagination. Go to the url's tab where you will have to:
- Activate Allow Page Numbers.
- Activate Allow URL Segments.
/*
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>
<?
/*Breadcrumbs
=====================
This is a general way to create breadcrumbs for ProcessWire pages.
It retreives in an array all the parents and will walk through the array to display the title and URL of the parents.
The last echo returns the title of the current page, without a link.
=====================*/
?>
<div id="breadcrumbs">