Recent Posts

Fix for protect staging sites with a password

  1. # Match all public hosts with one or more regex.
  2. SetEnvIfNoCase Host ^drupal\.org PUBLIC_SITE=1
  3.  
  4. # Allow everyone to see a public site
  5. Allow from env=PUBLIC_SITE
  6. Deny From All
  7.  
  8. # Define another

protect staging sites with a password

  1. # Match all public hosts with one or more regex.
  2. SetEnvIfNoCase Host ^drupal\.org PUBLIC_SITE=1
  3.  
  4. # Allow everyone to see a public site
  5. Allow from env=PUBLIC_SITE
  6. Deny From All
  7.  
  8. # Define another

Code

  1. <div id="region">
  2.  <?php print $region; ?>
  3. </div>

Code

  1.  function phptemplate_menu_tree($tree) {
  2.   return '<ul id="jsddm">'. $tree .'</ul>';
  3. }

PHP for default argument

  1. if (arg(0) == 'node' && is_numeric(arg(1))) {
  2.   $group_node = node_load(arg(1));
  3.   // Need to use this AMO key to match across tables to the Organization nid
  4.   $group_amokey = $group_node->field_gr

imagefield in other form

  1. function epvext_photos_page_form($form_state) {
  2.   $form = array();
  3.   drupal_load('module', 'filefield');
  4.   module_load_include('inc', 'imagefield', 'imagefield_widget.inc');
  5.   module_load_include(

autocomplete

  1. <?php
  2. function example_autocomplete($string = '') {
  3.   $matches = array();
  4.   if ($string) {
  5.     $result = db_query_range("SELECT dst FROM {url_alias} WHERE LOWER(dst) LIKE LOWER ('%s%%')", $string,

Code

  1.   /**
  2.    * The jQuery.sharethis() function will process through the queue and create
  3.    * the elements.
  4.    */
  5.   jQuery.shareThis = function() {
  6.     // Loop through the process queue.
  7.     jQuery.

Fix for 123

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2.  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
  4.   <head

123

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2.   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
  4.   <head

user has nodes of type

  1. $count_nodes = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE type = '%s' AND uid = %d", 'story', 5))

Code

  1. <?php
  2. if (arg(0) == 'user' && is_numeric(arg(1))) {
  3. $account = user_load(arg(1));
  4.  global $user;
  5.   if ($user->uid == $account->uid) {
  6.   $businessnode = node_load(array('type' => 'firmenprofil',

Code

  1. function mymod_install() {
  2.   db_query("UPDATE {system} SET weight = -1 WHERE name = 'mymod'");
  3. }
  4.  
  5. function mymod_form_alter(&$form, &$form_state, $form_id) {
  6.   if ($form_id == 'user_profile_form'

Fix for a hook_form_alter for user_profile_form

  1. function foo_form_alter(&$form, $form_state, $form_id){
  2.         switch ($form_id){
  3.                 case 'user_profile_form':
  4.                         global $user;
  5.                         /**
  6.                         *       Account Info subtab
  7.                         */
  8.                         if(is_array($form['account']))

Code

  1.    $logo = '<div id="logo">' .
  2.             '  <a href="' . check_url($vars['front_page']) . '" title=" . $vars['site_title'] . '">' .
  3.            '    <img src="' . check_url($vars['logo']) .

Code

  1.   <?php
  2.  
  3. if (arg(0) == 'user' && is_numeric(arg(1))) {
  4. $account = user_load(arg(1));
  5.  global $user;
  6.   if ($user->uid == $account->uid) {
  7.  
  8.     $output .= 'Sie sind doof.</a>';
  9.  
  10. print $output;

WorksForWeb Classifieds Ads Software for online business

  1. WorksForWeb is a software development company specialized in Web-based applications with focus on PHP  classifieds ads software.

Youtube try for IE

  1. <embed src="http://www.youtube.com/watch?v=5FXftDcwL-w" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed>

Weird Views2 sql for relationship

  1. SELECT node.nid AS nid,
  2.    node.title AS node_title,
  3.    node_data_field_pubmed_id.field_pubmed_id_value AS node_data_field_pubmed_id_field_pubmed_id_value,
  4.    node.type AS node_type,
  5.    node.vid A

Code

  1. /*
  2.  * Implementatino of hook_mail().
  3.  */
  4. function misc_mail($key, &$message, $params) {
  5.   $language->message['language'];
  6.   switch($key) {
  7.     case 'make_an_offer':
  8.       $message['subject'] =
Syndicate content