PHP

Facebook development tool

This link lets you try a variety of facebook code

http://www.fbrell.com
If you click Examples under the entry box it gives you a list of all of their methods you can work with and then plugs them into a dev environment.

Codit: Template Tracers for Drupal

One of the confusions with Drupal is knowing where content is coming from, what tpl controls it and where the tpl resides. Place the following template tracer code at the start and end of the output on a tpl and this will never cause confusion again.

Revealing the actual location of the template file is made secure by only revealing the template location if the user has permission to see template tracer output.

Sort an array of objects

Here is a quick php bit of code to sort an array of objects.

array grab or add

array_unshift() - (aka Prepend ;; InsertBefore ;; InsertAtBegin )
array_shift() - (aka UnPrepend ;; RemoveBefore ;; RemoveFromBegin )

array_push() - (aka Append ;; InsertAfter ;; InsertAtEnd )
array_pop() - (aka UnAppend ;; RemoveAfter ;; RemoveFromEnd )

TemplatIt

This a very easy yet powerful easy to use templating system with special adaptations for being responsive.

https://github.com/swirtSJW/templatit

Debugging $_GET for debugging on a LIVE server

The following bit of php code will can help you quickly debug something on LIVE or core without outputting stuff to everyone. It also throws no notices if no $_GET is present. Appending ?debug=debug to the URL will cause it to engage.

Freedom from Internet Explorer Compatibility Mode - ie broken

We are often plagued by complaints from clients that something is broken, only to discover that it is due to the user's browser being in compatibility mode.

This can be overridden by setting both the server header response

<?php
header
('X-UA-Compatible: IE=edge');
?>

and the metatag of

codit_sanitize_boolean() - Sanitize Boolean Values and control their format

This is a handy function to use to be able to pass it a variety of values and have the function return either of three flavors of boolean values.

Pages

Subscribe to RSS - PHP