Skip to content

Instantly share code, notes, and snippets.

@kongondo
kongondo / RandomImages.module
Created Jun 7, 2013 — forked from somatonic/RandomImages.module
get random images across pages optimized
View RandomImages.module
<?php
/**
* Example use:
*
* $helper = $modules->get("RandomImages");
* $image = $helper->getRandomImages(1,"images");
* echo "<img src='{$image->size(150,0)->url}'>";
*/
@kongondo
kongondo / form-builder-html5off.php
Created Jun 7, 2013 — forked from somatonic/form-builder-html5off.php
turn off html5 validation in form builder
View form-builder-html5off.php
<?php
// in form-builder.inc
$forms->addHookBefore('FormBuilderProcessor::render', null, 'hookRenderForm');
function hookRenderForm(HookEvent $event) {
$processor = $event->object;
$form = $processor->getInputfieldsForm();
$form->attr('novalidate', '1');
}
@kongondo
kongondo / paginator.php
Last active Dec 18, 2015 — forked from somatonic/paginator.php
manual pagination example for in memory page arrays
View paginator.php
<?php
/**
* include paginator class from ProcessWire core, $config->paths->Modulename can
* be used to get the path of any module in PW.
*/
require_once($config->paths->MarkupPagerNav . "PagerNav.php");
/**
@kongondo
kongondo / repeater_example.php
Created Jun 7, 2013 — forked from somatonic/repeater_example.php
example repeater creation and save front-end form
View repeater_example.php
<?php
$mypage = $pages->get("/about/");
if($input->post->submit){
$n = 1;
$title = "element_title_$n";
$url = "external_url_$n";
$mypage->setOutputFormatting(false);
@kongondo
kongondo / AddPageFieldProperty.module
Created Jun 7, 2013 — forked from somatonic/AddPageFieldProperty.module
add page field as property to page example
View AddPageFieldProperty.module
<?php
/**
* ProcessWire AddPageFieldProperty demonstration module
*
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
@kongondo
kongondo / MapPageField.module
Created Jun 7, 2013 — forked from somatonic/MapPageField.module
maps two page fields POC
View MapPageField.module
<?php
class MapPageField extends WireData implements Module{
public static function getModuleInfo(){
return array(
'title' => 'MapPageField',
'version' => 100,
'singular' => true,
'autoload' => true
@kongondo
kongondo / find matches example
Created Jun 7, 2013 — forked from somatonic/find matches example
PW search and find matches
View find matches example
$words = '';
$q = $sanitizer->selectorValue($input->post->q);
$words = explode(' ', $q);
foreach($words as $word) {
$word = $sanitizer->selectorValue($word);
if($word) $selectorEmergencyContacts .= "title|label_$lang*=$word, ";
}
...
View breadcrumbs.php
foreach($page->parents as $p) echo "<a href='$p->url'>$p->title</a>";
@kongondo
kongondo / ModuleName.module
Created Jun 7, 2013 — forked from somatonic/ModuleName.module
ProcessWire Module Template. It demonstrates the Module interface and how hooks are added
View ModuleName.module
<?php
/**
* ProcessWire Module Template
*
* Demonstrates the Module interface and how to add hooks.
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
View ProcessDashboard.module
<?php
/*
*
*
*
*/
class ProcessDashboard extends Process {
You can’t perform that action at this time.