burningdog

How theme variables work

  1. //in win.module
  2.  
  3. <?php
  4. /*
  5.  * Implementation of hook_preprocess_node
  6.  */
  7. function win_preprocess_node(&$variables) {
  8.   switch ($variables['node']->type) {
  9.     //Win a Prize
  10.     case 'win_prize

How the 'sticky' checkbox gets generated

  1.   // Node options for administrators
  2.   $form['options'] = array(
  3.     '#type' => 'fieldset',
  4.     '#access' => user_access('administer nodes'),
  5.     '#title' => t('Publishing options'),
  6.     '#collap

Code

  1. <?php
  2. print_r($argument);
  3. ?>

Fix for Submit and hide a form

  1. $(document).ready(function(){
  2.  
  3.   //removes submit button - assumed the class of the button is "form-submit"
  4.   $('.form-submit').remove();
  5.  
  6.   //adds a new submit button to the form with the class

Submit and hide a form

  1. $(document).ready(function(){
  2.  
  3.   //removes all 'Vote' submit buttons
  4.   $('.form-submit').remove();
  5.  
  6.   //adds a new submit button
  7.   $(".my-form").append('<input type="submit" value="Submit" class

Checking which vehicles are available to be booked during a certain date range

  1. function _check_available_vehicles(&$form) {
  2.   //get the "from" and "to" dates
  3.   if ($form['#post']) {

a 'hello world' example with AHAH

  1. function _update_available_vehicles_select_list() {
  2.   // We're starting in step #3, preparing for #4.
  3.   $form_state = array('storage' => NULL, 'submitted' => FALSE);

Working NOT EXISTS sql query

  1. #this query now works. It shows me all vehicles which are available on a particular day
  2.  
  3. SELECT node.nid AS nid,
  4. node.title AS title
  5. FROM node
  6. WHERE (node.STATUS <> 0)

EXISTS vs NOT EXISTS as a sql query

  1. # I have 3 vehicle nodes: 3, 26, 28. The following query should return ONLY nid 3, but it returns 3, 26, 28.
  2.  
  3. SELECT node.nid AS nid
  4. FROM node

Showing vehicle nodes which don't exist in vehicle_booking nodes

  1. #this SQL query has 2 parts. Part 1 shows all vehicles and vehicle bookings nodes (both are CCK types). This returns 4 rows (3 vehicles + 1 vehicle booking)
  2.  
  3. SELECT node.nid AS nid,

Migrating the ec_file module to Drupal 6

  1. A conversation with gordonh (lead developer of ecommerce) on irc to see about the possibility of migrating the file module to ec4 in D6, so that ec4 can sell file downloads.
Syndicate content