home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (spain_724_1.cif)

This example Drupal source code file (spain_724_1.cif) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, as, db_query, foreach, function, into, php, sql, values, zone, zones

The spain_724_1.cif Drupal example source code

<?php
// $Id: spain_724_1.cif,v 1.3.4.4 2010/04/14 05:18:19 tr Exp $

/**
* First implement hook_install() using the name of the country as the base of
* the function name.
*/
function spain_install() {
  // Make the entry in the country table.
  // VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
  db_query("INSERT INTO {uc_countries} (country_id, country_name, country_iso_code_2, country_iso_code_3, version) VALUES ('724', 'Spain', 'ES', 'ESP', 1)");

  // Make the entries in the zones table.
  $zones = array(
    array(724, 'CA', 'A Coruña'),
    array(724, 'AL', 'Álava'),
    array(724, 'AB', 'Albacete'),
    array(724, 'AC', 'Alicante'),
    array(724, 'AM', 'Almería'),
    array(724, 'AS', 'Asturias'),
    array(724, 'AV', 'Ávila'),
    array(724, 'BJ', 'Badajoz'),
    array(724, 'IB', 'Baleares'),
    array(724, 'BA', 'Barcelona'),
    array(724, 'BU', 'Burgos'),
    array(724, 'CC', 'Cáceres'),
    array(724, 'CZ', 'Cádiz'),
    array(724, 'CT', 'Cantabria'),
    array(724, 'CL', 'Castellón'),
    array(724, 'CE', 'Ceuta'),
    array(724, 'CR', 'Ciudad Real'),
    array(724, 'CD', 'Córdoba'),
    array(724, 'CU', 'Cuenca'),
    array(724, 'GI', 'Girona'),
    array(724, 'GD', 'Granada'),
    array(724, 'GJ', 'Guadalajara'),
    array(724, 'GP', 'Guipúzcoa'),
    array(724, 'HL', 'Huelva'),
    array(724, 'HS', 'Huesca'),
    array(724, 'JN', 'Jaén'),
    array(724, 'RJ', 'La Rioja'),
    array(724, 'PM', 'Las Palmas'),
    array(724, 'LE', 'León'),
    array(724, 'LL', 'Lleida'),
    array(724, 'LG', 'Lugo'),
    array(724, 'MD', 'Madrid'),
    array(724, 'MA', 'Málaga'),
    array(724, 'ML', 'Melilla'),
    array(724, 'MU', 'Murcia'),
    array(724, 'NV', 'Navarra'),
    array(724, 'OU', 'Ourense'),
    array(724, 'PL', 'Palencia'),
    array(724, 'PO', 'Pontevedra'),
    array(724, 'SL', 'Salamanca'),
    array(724, 'SC', 'Santa Cruz de Tenerife'),
    array(724, 'SG', 'Segovia'),
    array(724, 'SV', 'Sevilla'),
    array(724, 'SO', 'Soria'),
    array(724, 'TA', 'Tarragona'),
    array(724, 'TE', 'Teruel'),
    array(724, 'TO', 'Toledo'),
    array(724, 'VC', 'Valencia'),
    array(724, 'VD', 'Valladolid'),
    array(724, 'VZ', 'Vizcaya'),
    array(724, 'ZM', 'Zamora'),
    array(724, 'ZR', 'Zaragoza'),
  );

  foreach ($zones as $zone) {
    db_query("INSERT INTO {uc_zones} (zone_country_id, zone_code, zone_name) VALUES (%d, '%s', '%s')", $zone);
  }

  // Use uc_set_address_format() with the country ID as the first argument and
  // an address format string as the second.  Documentation on address formats
  // is available at:
  // http://www.ubercart.org/ubercart_users_guide/country_settings#address_format_docs
  uc_set_address_format(724,
    "!company\n!first_name !last_name\n!street1\n!street2"
   ."\n!postal_code !city\n!country_name_if");
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal spain_724_1.cif source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.