Skip to content

Instantly share code, notes, and snippets.

View search-processor.php
<?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");
View search-form.php
<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' " : '';
@kongondo
kongondo / ImageCreateThumbs.module
Created Jun 7, 2013 — forked from somatonic/ImageCreateThumbs.module
create thumbs when uploading image
View ImageCreateThumbs.module
<?php
class ImageCreateThumbs extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'ImageCreateThumbs',
'version' => 100,
'summary' => '',
@kongondo
kongondo / form-example.php
Created Jun 7, 2013 — forked from somatonic/form-example.php
PW simple form via API
View form-example.php
<?php
$out = '';
// create a new form field (also field wrapper)
$form = $modules->get("InputfieldForm");
$form->action = "./";
$form->method = "post";
$form->attr("id+name",'subscribe-form');
@kongondo
kongondo / from.php
Created Jun 7, 2013 — forked from somatonic/from.php
Create a page edit form on frontend using PW API and fields from the template of the page
View from.php
<?php
// get a page
$editpage = $pages->get("/editme/");
$ignorefields = array("isOld","language_published");
$form = $modules->get("InputfieldForm");
$form->method = 'post';
$form->action = './';
@kongondo
kongondo / upload_images_to_page_form.php
Created Jun 7, 2013 — forked from somatonic/upload_images_to_page_form.php
Upload Images to new created Page Form Example
View upload_images_to_page_form.php
<?php
// front-end form example with multiple images upload
// add new page created on the fly and adding images
$message = '';
if($input->post->submit){
// tmp upload folder for additional security
@kongondo
kongondo / form-process.php
Created Jun 7, 2013 — forked from somatonic/form-process.php
ProcessWire example front-end form with file upload and fields
View form-process.php
<?php
// ------------------------------ FORM Processing ---------------------------------------
$errors = null;
$success = false;
// helper function to format form errors
function showError($e){
return "<p class='error'>$e</p>";
@kongondo
kongondo / form.php
Created Jun 7, 2013 — forked from somatonic/inputfieldfile-form.php
ProcessWire front-end upload form example using ProcessWire Inputfields and form processing.
View form.php
<?php
/**
* Front-end upload form example
* using ProcessWire Inputfields
*/
$sent = false;
$upload_path = $config->paths->assets . "files/.tmp_uploads/";
@kongondo
kongondo / form_with_fields_in_table.php
Created Jun 7, 2013 — forked from somatonic/form_with_fields_in_table.php
form with fields rendered in a table example
View form_with_fields_in_table.php
<?php
/**
* Example form using PW API
*
* A workaround to get fields display in a table
* Those fields are marked with a property added to the fields $field->tablerow
*
* Approach is to grab those fields after form is put together and maybe processed,
* loop each row and render out the fields along with possible errors and add it to a string variable $table
* while we remove the field from the form at the same time.
@kongondo
kongondo / HiddenAdminPages.module
Created Jun 7, 2013 — forked from somatonic/HiddenAdminPages.module
Hide page in the admin per user per page/branch
View HiddenAdminPages.module
<?php
/**
* UserWorkspaces
*
* Example module to hide page in the admin per user per page.
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
You can’t perform that action at this time.