Category Archives: PHP

(PHP) Regex for trimming whitespace

 

Posted in PHP | Tagged , , , , , , | Leave a comment

(PHP) GD Thumbnail Generator

Tweaked from the icant.co.uk thumbnail generator

Posted in PHP | Tagged , , , , , , , , , | 1 Comment

(PHP) Clean Input

code below can be used to clean any input, submitted by any form etc.

Posted in PHP | Tagged , , , , , | Leave a comment

LView – PHP View Class

View class that contains features like: – get vars inside the view with: 1) $var1 2) $this->var1 3) or $this->get( ‘var1′, ‘defaultValue’ ) – factory method for direct chaining: LView::factory( ‘test.php’ )->set( ‘var1′, ‘value1′ )->show(); – set filter callbacks that will be executed right after rendering – set global vars and global filters to be [...]

Posted in PHP | Tagged , , , , , , , , , | Leave a comment

(PHP) Drupal 7: custom template based on url alias

This will give you the ability to create custom node templates based on the URL alias of a page. Example: if you create a page with the URL alias “aboutus”, you can now use node–page-aboutus.tpl.php as your node template.

Posted in PHP | Tagged , , , , , , | Leave a comment

(PHP) XML Parser

Posted in PHP | Tagged , , , | Leave a comment

(PHP) Simple MySQL Search Function

A quick and simple way to search a MySQL database. Example: mysql_search(‘items’, ‘title tags’, isset($_GET['q'])?$_GET['q']:”, Array(‘columns’=>’*’, ‘method’=>’OR’, ‘extra_sql’=>’AND active = “true” ORDER BY id DESC’));

Posted in PHP | Tagged , , , , , | Leave a comment

(PHP) RSS Writer Class

Contains two classes. RSS and RSSItem. Create a new RSS object and then populate it with RSSItems. Supports enclosures (audio/video files).

Posted in PHP | Tagged , , , | Leave a comment

(PHP) Anti-SQL Injection Function

Posted in PHP | Tagged , , , | Leave a comment

(PHP) MySQL Dump

Creates a backup of a MySQL database in SQL format.

Posted in PHP | Tagged , , , | Leave a comment