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
$event_date = "2012-10-06"; | |
$event_end_date = "2012-10-08"; | |
$event_repetition_type = "Daily"; | |
$date_calculation = ""; | |
switch ($event_repetition_type) { | |
case "Daily": | |
$date_calculation = " +1 day"; | |
break; | |
case "Weekly": |
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 | |
$file = 'name_of_the_file.zip'; | |
$path = pathinfo(realpath($file), PATHINFO_DIRNAME); | |
$zip = new ZipArchive; | |
$res = $zip->open($file); | |
if ($res === TRUE) { | |
$zip->extractTo($path); | |
$zip->close(); | |
echo "$file extracted to $path"; | |
} else { |
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 | |
// via field settings | |
$field = $fields->get("title"); | |
echo "width:" . $field->columnWidth; | |
// via template context | |
$tpl = $templates->get("basic-page"); | |
$field = $tpl->fieldgroup->getField("title", true); | |
echo "width:" . $field->columnWidth; |
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 | |
$children = $pages->get("/shop/")->children(); | |
$list = new PageArray(); | |
function mylist($children, $ind='', $arr){ | |
$ind .= "– "; | |
foreach($children as $cat) { |
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 use: | |
* | |
* $helper = $modules->get("RandomImages"); | |
* $image = $helper->getRandomImages(1,"images"); | |
* echo "<img src='{$image->size(150,0)->url}'>"; | |
*/ | |
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 | |
/** | |
* Front-end upload form example | |
* using ProcessWire Inputfields | |
*/ | |
$sent = false; | |
$upload_path = $config->paths->assets . "files/.tmp_uploads/"; |
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 | |
// ------------------------------ FORM Processing --------------------------------------- | |
$errors = null; | |
$success = false; | |
// helper function to format form errors | |
function showError($e){ | |
return "<p class='error'>$e</p>"; |
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 | |
// include("./head.inc"); | |
/** | |
* Script Example | |
* | |
* This script generates a prev next pagination to show posts per day of a specified date | |
* The category is set by the first url segment the date in the second |
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 | |
/* | |
* as per http://processwire.com/talk/topic/2928-pagination-by-date/ | |
* list posts by day, show prev next day if any posts found | |
* | |
* - posts have a date field "publish_from" | |
* with no time selection but only days | |
* this will save the timestamp of today 00:00 (starting) so we can simply | |
* use "publish_from=$prevday" in selectors |
OlderNewer