Fix for Code

  1. function cromods_community_block() {
  2.   global $_domain;
  3.   $domain_list = array();
  4.   static $domain_messages = array();
  5.   $domain_id = $_domain['domain_id'];
  6.  
  7.   if (!empty($domain_messages[$domain_id])) {
  8.     return $domain_messages[$domain_id];
  9.   }
  10.  
  11.   $domain_count = 1;
  12.   $domain_list[$domain_count] = $_domain;
  13.  
  14.   $parent_id = domain_relationships_domain_parent($domain_list[$domain_count]['domain_id']);
  15.   while ($parent_id != -1) {
  16.     $domain_count++;
  17.     $domain_list[$domain_count] = domain_lookup($parent_id);
  18.     $parent_id = domain_relationships_domain_parent($domain_list[$domain_count]['domain_id']);
  19.   }
  20.  
  21.   if($domain_count > 1) {
  22.     // Only show the block when we are not on the root domain.
  23.    
  24.     switch($domain_count) {
  25.       case 2:
  26.         // Viewing at the state level.
  27.         $state = $_domain['sitename'];
  28.         $message = "<strong>You are viewing only content from the state of $state.</strong> <br />You can also see everything in the <a href=\"http://couleeregiononline.com\">Coulee Region</a> or <a href=\"\communities\">choose another community</a>.";
  29.         break;
  30.        
  31.       case 3:
  32.         // Viewing at the county level.
  33.         $county = $_domain['sitename'];
  34.         $state = '<a href="http://' . $domain_list[2]['subdomain'] . '">' . $domain_list[2]['sitename'] . '</a>';
  35.         $message = "<strong>You are viewing only content from $county.</strong> <br />You can find more by going to $state, the <a href=\"http://couleeregiononline.com\">Coulee Region</a>, or <a href=\"\communities\">choosing another community</a>.";
  36.         break;
  37.        
  38.       case 4:
  39.         // Viewing at the community level.
  40.         $community = $_domain['sitename'];
  41.         $county = '<a href="http://' . $domain_list[2]['subdomain'] . '">' . $domain_list[2]['sitename'] . '</a>';
  42.         $state = '<a href="http://' . $domain_list[3]['subdomain'] . '">' . $domain_list[3]['sitename'] . '</a>';
  43.         $message = "<strong>You are viewing only content posted in $community.</strong> <br />You can find more by going to $county, $state, the <a href=\"http://couleeregiononline.com\">Coulee Region</a>, or <a href=\"\communities\">choosing another community</a>.";
  44.         break;
  45.     }
  46.    
  47.     $domain_messages[$domain_id] = $message;
  48.     return $message;
  49.   }
  50. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.