Skip to content

Instantly share code, notes, and snippets.

View arjenblokzijl's full-sized avatar

Arjen Blokzijl arjenblokzijl

View GitHub Profile
<?php
/**
* ProcessWire example demonstration module
*
* PageListActionHook autoload module once installed will remove "new" action from second level pages
* using the template "basic-page"
*
*/
@arjenblokzijl
arjenblokzijl / pf2pt.php
Created July 8, 2014 18:17
Simple script to convert Page field to Pagetable
<?php
include("index.php");
$pages = wire()->pages;
$stadiums = $pages->find("template=template, field.count>0");
$ptf = "template";
$ptt = "fieldname";
@arjenblokzijl
arjenblokzijl / gist:9272411
Last active April 25, 2018 15:18
Generate ProcessWire pages with random titles, body and image
<?php
for ($i = 1; $i <= 20; $i++)
{
$title = file_get_contents("http://loripsum.net/api/1/plaintext/long/prude/");
$body = file_get_contents("http://loripsum.net/api/3/decorate/link/ul/prude/long/");
$template = "INSERT_TEMPLATE_HERE"; // i.e. 'basic-page'
$parent = "INSERT_PARENT_HERE"; // i.e. /about-us/
$c = new Page();
<?php
// .... module
// create fields and templates using arrays
public function getTemplatesConfig() {
// title | field1 | field2 ...
$templatesArray = array(
'category' => array('title'),
@arjenblokzijl
arjenblokzijl / gist:5656671
Last active December 17, 2015 18:58
Test for E-commerce plugin by apeisa
<?php
class ShoppingCheckout extends WireData implements Module, ConfigurableModule
{
public static function getModuleInfo()
{
return array(
'title' => 'Shopping Checkout',
'version' => 001,
'summary' => 'Handles checkout process, order saving etc. Main module for PW Shop',
@arjenblokzijl
arjenblokzijl / gist:5622347
Created May 21, 2013 19:05
Fixed an unknown issue on a ProcessWire module. This gist is just temporary.
<?php
/**
*
* Multisite module for Processwire
* (C) 2012 Antti Peisa, Avoine Oy
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
@arjenblokzijl
arjenblokzijl / gist:5207400
Last active December 15, 2015 05:09
Example of how to add children to the homepage in ProcessWire. See: http://processwire.com/talk/topic/3065-direct-children-of-default-front-page/.
<?php
// Get the homepage
$homepage = $pages->get("/");
// Get the all the children of home
$children = $homepage->children;
// Get all the homepage children who need to be under home in the menu
$homePageChildren = $homepage->children("homechild=1");