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 | |
use Cache; | |
use Cms\Classes\ComponentBase; | |
abstract class CachableComponentBase extends ComponentBase | |
{ | |
/** | |
* Build cache configuration which is an array: ['cachedKey' => 'The cache key value', 'cachedTimeInMinutes' => 'Cached time in minutes'] | |
* @return mixed |
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 | |
/** | |
* Export CSV | |
* | |
* @author Ivan Milincic <lokomotivan@gmail.com> | |
* @copyright 2017 Ivan Milincic | |
* | |
*/ | |
if($input->post->export_csv) { |
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
@mixin fill($offset: 0) { | |
// get a list with 4 numbers | |
@if type_of($offset) == 'number' { | |
$offset: ($offset $offset $offset $offset); | |
} @else if type_of($offset) == 'list' { | |
@if length($offset) == 2 { | |
$offset: join($offset, $offset); | |
} @else if length($offset) == 3 { |
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 namespace ProcessWire; | |
class ProcessDashboard extends Process implements Module | |
{ | |
public static function getModuleInfo() | |
{ | |
return [ | |
'title' => 'Orders Dashboard', | |
'summary' => 'Shows latest orders', |
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
$fontawesome_path: "." !default | |
@font-face | |
font-family: 'FontAwesome' | |
src: font-url('#{$fontawesome_path}/fontawesome-webfont.eot') | |
src: font-url('#{$fontawesome_path}/fontawesome-webfont.eot?#iefix') format("embedded-opentype"), font-url('#{$fontawesome_path}/fontawesome-webfont.woff') format("woff"), font-url('#{$fontawesome_path}/fontawesome-webfont.ttf') format("truetype") | |
font-weight: normal | |
font-style: normal | |
@mixin icon($icon) |
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
<!-- | |
favicons (see http://www.jonathantneal.com/blog/understand-the-favicon) | |
--- | |
icon format dimensions documentation | |
---- ------ ---------- ------------- | |
apple-touch-icon PNG 152x152 https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html#//apple_ref/doc/uid/TP40006556-CH27-SW1 | |
icon PNG 96x96 | |
shortcut icon ICO 32x32 | |
msapplication-TileImage PNG 144x144 |
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 | |
$mypage = $pages->get("/about/"); | |
if($input->post->submit){ | |
$n = 1; | |
$title = "element_title_$n"; | |
$url = "external_url_$n"; | |
$mypage->setOutputFormatting(false); |
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 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. |
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
hidden | |
------ | |
$field = $this->modules->get('InputfieldHidden'); | |
$field->label = __('Some Label'); | |
$field->attr('name+id','some_label'); | |
$field->attr('value', 'some value'); | |
submit | |
------ | |
$submit = $this->modules->get('InputfieldSubmit'); |
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 | |
class ContactForm | |
{ | |
var $form; | |
var $to = 'destination@email.com'; | |
var $toName = 'Destination Name'; | |
public function __construct() |
NewerOlder