Skip to content

Instantly share code, notes, and snippets.

@kongondo
kongondo / download.php
Created June 7, 2013 09:22 — forked from somatonic/download.php
A Download PHP Class
<?php
class download{
public function startDownload( $vFilePath, $vDownloadName=""){
$vFilename = basename( $vFilePath);
$vNewFilename = $vDownloadName == "" ? $vFilename : $vDownloadName;
$vFileType = $this->getFileType( $vFilename);
$vContentType = $this->GetContentType( $vFileType);
// Fix IE bug [0]
@kongondo
kongondo / PageReferenceLink.module
Created June 7, 2013 09:23 — forked from somatonic/PageReferenceLink.module
Add link from page reference fields - Module example
@kongondo
kongondo / FieldHelper.module
Created June 7, 2013 09:23 — forked from somatonic/FieldHelper.module
FieldHelper Module
<?php
/**
* ProcessWire Module FieldHelper
*
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
@kongondo
kongondo / TextAreaCounter.module
Created June 7, 2013 09:24 — forked from somatonic/TextAreaCounter.module
TextAreaCounter concept module
<?php
// start module to textarea counter
class TextAreaCounter extends WireData implements Module {
//const default_maxlength = 255;
/**
* getModuleInfo is a module required by all modules to tell ProcessWire about them
@kongondo
kongondo / TextAreaCounter.js
Created June 7, 2013 09:24 — forked from somatonic/TextAreaCounter.js
TextAreaCounter JScript for TextAreaCounter concept module
(function($){
$(function(){
$('textarea[data-maxlength]').each(function(){
$(this).bind("keyup change", function(){
var count = $(this).attr('data-maxlength') - $(this).val().replace(/\r?\n/g, '\r\n').length;
$(this).parent().find("span.counter span").text(count);
});
});
@kongondo
kongondo / TagsHelper.module
Created June 7, 2013 09:24 — forked from somatonic/TagsHelper.module
Find related pages using Fieldtype Page for tagging. Returns PageArray with added property "score" for later use.
<?php
/**
* TagsHelper ProcessWire2.+ Module
*
*
* @author Soma
* modified 2012/08/31
*
* ProcessWire 2.x
@kongondo
kongondo / posts.php
Created June 7, 2013 09:25 — forked from somatonic/posts.php
This script generates a list of post with a prev next pagination to show posts of a specified day and category through urls segments
<?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
@kongondo
kongondo / prev_next_day_posts.php
Created June 7, 2013 09:25 — forked from somatonic/prev_next_day_posts.php
example to render today posts with prev day next day links if found . with url segments for category and day date
<?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
@kongondo
kongondo / image_tags.php
Created June 19, 2013 09:12 — forked from somatonic/image_tags.php
Collect all tags from images field and create a link list to then filter pages with images that have the selected tag
<?php
/**
* collect all tags
* ======================================
*/
$alltags = array(); // container
// find all pages that have images with tags
<?php
/*
MarkupSimpleNavigation Example for Bootstrap 2.3.2 Multilevel Navbar
*/
// load MarkupSimpleNavigation module
$nav = $modules->get("MarkupSimpleNavigation");