stickee

Some useful WordPress Template Snippets

written by Karl Binder | April 5, 2013

Out of the box WordPress comes as a useful tool for creating simple brochure websites. The mass of community plugins also add real value to WordPress as a platform for building simple websites. When creating bespoke templates there are a few useful code snippets, which I have listed some of below, that come in handy […]

Read full details

What’s been cooking in the Codeigniter pot recently

written by Ed Genochio | April 3, 2012

A quick round-up of some Codeigniter-based projects we’ve worked on recently. A studio calendar that lets us keep track of everything in one view. A mobile phone recycling platform An online price comparison system A time-tracking / reporting system that integrates with Toggl A shopping app for iPhone Software for tracking client feedback I’ll post […]

Read full details

Using join in CodeIgniter Active Record delete

written by Ed Genochio | December 13, 2011

You might try this, using CodeIgniter’s Active Record class: $this->db->join(“table2”, “table1.thing_id = table2.id”) ->where(“table2.otherthing_id”, $id) ->delete(“table1”);   This doesn’t work, as CodeIgniter ignores joins when doing Active Record deletes. Instead, you’ll have to write out the SQL ‘manually’ – something like this: $sql = “DELETE t1 FROM table1 t1 JOIN table2 t2 ON t1.thing_id = […]

Read full details

Solving ‘MySQL server has gone away’ errors in Codeigniter

written by Ed Genochio | September 26, 2011

Problem: a long-running PHP script (in this case, a cron-job with a sleep() function in it) was triggering ‘MySQL server has gone away’ errors in a Codeigniter application. Solution: after each sleep() call, do this: $this->db->reconnect(); Problem solved. PS We’re actually using a little function called _randomsleep(), that goes like this: function _randomsleep() { $sleep […]

Read full details

Drupal – manually creating graphs with View variables

written by Karl Binder | April 24, 2010

This PHP snippet is pretty customised but shows how you can use variables passed in a view to created more graphical representations of the results with just CSS and no need for a graphs module. This snippet calculates percentage heights of a total graph area for each node in the view result and then sets […]

Read full details

Carphone Warehouse’s Connectmycar on Magento Ecommerce Website

written by Karl Binder | January 9, 2010

Ready to be launched this coming week is our new ecommerce website for Carphone Warehouse’s Car Accessories site ‘Connect My Car’. The old site was built on a now outdated Drupal 5 with OS Commerce. We had the options to upgrade to Drupal 6 with Ubercart or Magento, and between us we opted for using […]

Read full details

PHP Date Formats

written by Karl Binder | September 10, 2009

When printing a date field to the screen using PHP there is a variety of formats available. The table below, available on http://uk3.php.net/manual/en/function.date.php describes what they are. The following characters are recognized in the format parameter string format character Description Example returned values Day — — d Day of the month, 2 digits with leading […]

Read full details

Everybody wants curves…

written by Karl Binder | August 24, 2009

I’m always getting asked for curved corners. It’s easy to get sick of curved corner boxes and the like when overdone everywhere, same as the overuse of an design feature. I’ve actually had someone specify to me in the past that they wanted their new web design to be ‘web 2.0: curved corners and flash […]

Read full details

Drupal – Show all Args on a page

written by Karl Binder | July 9, 2009

You can add this snippet to any template page in Drupal to echo out all available variable on a page. print_r(func_get_args());

Read full details

Why WordPress?

written by Karl Binder | July 4, 2009

Open source software has it’s pros and cons. Our CMS of choice at this time in 2009 is still generally is Drupal, especially for the larger sites, but WordPress has come a long way in the last few years, and although still ideal for it’s blogging roots, has now become a much more versatile CMS. […]

Read full details

Show drupal Taxonomy Image List

written by Karl Binder | May 24, 2009

The PHP snippet show below loads all the taxonomy terms from a particular vocabulary and shows the taxonomy image associated to it. Good for displaying categories as images: <?php if ( ! function_exists(‘private_get_children’) ) { function private_get_children($vid, $parent = 0) { $items = array(); $terms = taxonomy_get_tree($vid, $parent, -1, 1); foreach ( $terms as $term […]

Read full details

Listing Drupal Taxonomy Terms

written by Karl Binder |

This PHP snippet can be used in a Drupal template or block to show a list of taxonomy terms in a certain vocabulary. Change the $vid to match your vocab ID: $vid = 1; // Set the vid to the vocabulary id of the vocabulary you wish to list the terms from $items = array(); […]

Read full details

CCK – Showing custom fields in a tpl.php

written by Karl Binder |

The following snippets are to be used in Drupal theming tpl files to display custom fields. They work in node.tpl.php and node variations. You need to change the field name to match your CCK field: <?php print $node->content[‘body’][‘#value’];  ?> PRINTS THE NODE BODY/DESCRIPTION <?php print $node->content[‘sell_price’][‘#value’];  ?> PRINTS AN UBERCART SELL PRICE <?php echo $node->field_range[0][‘safe’]; […]

Read full details