This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// .... module | |
// create fields and templates using arrays | |
public function getTemplatesConfig() { | |
// title | field1 | field2 ... | |
$templatesArray = array( | |
'category' => array('title'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* creates a compressed zip file */ | |
function create_zip($files = array(),$destination = '',$overwrite = false) { | |
if(file_exists($destination) && !$overwrite) { return false; } | |
if(is_array($files)) { | |
foreach($files as $name => $file) { | |
if(!file_exists($file)) unset($files[$name]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// stripped down code | |
$old_name = 'lizard.jpg'; | |
$new_name = 'wizard'; | |
$p = $pages->find("image.data=$old_name")->first(); | |
$p->of(false); // outputformatting off, single and multiple image fields are from now on wire array's |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Bootstrap ProcessWire | |
require 'index.php'; | |
// Make sure that FieldtypeRepeater is installed and ready for use | |
if (!wire('modules')->isInstalled('FieldtypeRepeater')) { | |
if (wire('modules')->isInstallable('FieldtypeRepeater')) { | |
wire('modules')->install('FieldtypeRepeater'); | |
echo "Module FieldtypeRepeater installed\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Example by Ryan Cramer @ProcessWire - http://processwire.com/talk/topic/5480-configurable-process-module-need-walk-through/?p=53729 | |
class YourModule extends WireData implements Module, ConfigurableModule { | |
public static function getModuleInfo() { | |
return array('title' => 'Your Module', 'version' => 1); | |
} | |
const defaultValue = 'smith'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Script: DataTables server-side script for PHP and MySQL | |
* Copyright: 2012 - John Becker, Beckersoft, Inc. | |
* Copyright: 2010 - Allan Jardine | |
* License: GPL v2 or BSD (3-point) | |
*/ | |
class TableData { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
CODE COPIED FROM https://processwire.com/talk/topic/6142-hide-page-tree-in-the-admin/ | |
One hook returns false for Page::viewable() for the ProcessPageList page. | |
Another Hook can be used to redirect users to a custom admin page after login. | |
*/ | |
// This needs to be an autoload module | |
public function init() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adding other types of save buttons for page edit form. | |
* | |
* ProcessWire 2.x | |
* Copyright (C) 2010 by Ryan Cramer | |
* Licensed under GNU/GPL v2, see LICENSE.TXT | |
* | |
* http://www.processwire.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Code by Ryan Cramer | |
Integrating a member visitor login form | |
https://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/?p=15919 | |
*/ | |
/* | |
I recently had to setup front-end system to handle logins, password resets and changing passwords, so here's about how it was done. This should be functional code, but consider it pseudocode as you may need to make minor adjustments here and there. Please let me know if anything that doesn't compile and I'll correct it here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function renderPosts($posts, $small = false, Array $options = null) { | |
$blogConfigs = wire('modules')->getModuleConfigData('ProcessBlog'); | |
//intialise some properties from ProcessBlog config | |
$commentsUse = $blogConfigs['commentsUse']; | |
$authorsPage = wire('pages')->get($blogConfigs['blog-authors']); | |
$settingsPage = wire('pages')->get($blogConfigs['blog-settings']); |