Churches Overview

| Last edited: 8/20/2008

Churches have two display types: list and detail. Additionally, a search form can be used to find churches.

Also see the churches API article.

Search Form

Here is an example search form which can be used to search for churches on different categories.

Prepaire the state search:

  $STATES = array(
           'AL' => 'Alabama',
           'AK' => 'Alaska',
           'AZ' => 'Arizona',
           'AR' => 'Arkansas',
           'CA' => 'California',
           'CO' => 'Colorado',
           'CT' => 'Connecticut',
           'DE' => 'Delaware',
           'DC' => 'Dist Columbia',
           'FL' => 'Florida',
           'GA' => 'Georgia',
           'HI' => 'Hawaii',
           'ID' => 'Idaho',
           'IL' => 'Illinois',
           'IN' => 'Indiana',
           'IA' => 'Iowa',
           'KS' => 'Kansas',
           'KY' => 'Kentucky',
           'LA' => 'Louisiana',
           'ME' => 'Maine',
           'MD' => 'Maryland',
           'MA' => 'Massachusetts',
           'MI' => 'Michigan',
           'MN' => 'Minnesota',
           'MS' => 'Mississippi',
           'MO' => 'Missouri',
           'MT' => 'Montana',
           'NE' => 'Nebraska',
           'NV' => 'Nevada',
           'NH' => 'New Hampshire',
           'NJ' => 'New Jersey',
           'NM' => 'New Mexico',
           'NY' => 'New York',
           'NC' => 'North Carolina',
           'ND' => 'North Dakota',
           'OH' => 'Ohio',
           'OK' => 'Oklahoma',
           'OR' => 'Oregon',
           'PA' => 'Pennsylvania',
           'PR' => 'Puerto Rico',
           'RI' => 'Rhode Island',
           'SC' => 'South Carolina',
           'SD' => 'South Dakota',
           'TN' => 'Tennessee',
           'TX' => 'Texas',
           'UT' => 'Utah',
           'VT' => 'Vermont',
           'VA' => 'Virginia',
           'WA' => 'Washington',
           'WV' => 'West Virginia',
           'WI' => 'Wisconsin',
           'WY' => 'Wyoming'
           );

    foreach ($STATES as $S => $name) {
      $stateSelect.="<option value='$S'>$name</option>";
    }

A few forms for different criteria:

Search by Zip Code:<form id="search_by_zip" method="get" action="/find-a-church-results/">
   <fieldset>
      <p>
         <label for="zip" class="textbox">Search by Zip Code:</label>
         <input type="text" name="zip" value="" id="zip" class="textbox" />
         <label for="church_radius" class="textbox">Radius:</label> <select name="radius" id="radius">
           <option value="5">5 miles</option>
           <option value="20">20 miles</option>
           <option value="50">50 miles</option>
           <option value="100">100 miles</option>
         </select>
         <input type="submit" name="search_by_zip_go" value="Search" id="search_by_zip_go" />
      </p>

   </fieldset>
</form>

Search by state:
<form id="search_by_other" method="get" action="/find-a-church-results/">
   <fieldset>
      <p>
         <label for="church_state" class="textbox">Search By State:</label>
         <select name="church_state" id="church_state">
          <option value="">Choose a State</option>
          <?=$stateSelect?>
         </select>
         <input type="submit" name="search_by_other_go" value="Search" id="search_by_other_go" />
      </p>
   </fieldset>
</form>

Search by countries, only will show countries containing churches:
<form id="search_by_other" method="get" action="/find-a-church-results/">
   <fieldset>
      <p>
         <label for="church_country" class="textbox">Search By Country:</label>
         <select name="church_country" id="church_country">
          <option value="">Choose a Country</option>
          <?php
            getContent(
            "church",
            "display:list",
            "groupby:country",
            "group_show:<option value="__slug__">__title__</option>"
            );
          ?>
         </select>
         <input type="submit" name="search_by_other_go" value="Search" id="search_by_other_go" />
      </p>
   </fieldset>
</form>

Church List

Some PHP to prepaire the search:

if ($_GET['zip']) {
  $search=$_GET['zip'];
}
elseif ($_GET['church_city'] && $_GET['church_state']) {
  $state=$_GET['church_state'];
  $city=$_GET['church_city'];
  $search="US|$state|$city";
}

Example

<?php
  getContent(
  "church",
  "display:list",
  "search_location:$search",
  "radius:".$_GET['radius'],
  "search_state:".$_GET['church_state'],
  "search_country:".$_GET['church_country'],
  "noshow:<p class="results">Your search for '__searchterm__' returned 0 results</p><div class="result"></div>",
  "show_before:<p class="results">Your search for __searchterm__ returned __records__ results</p>",
// for one google map above the results with pin points for each church
//"show_before:__googlemap key='YOURGOOGLEMAPKEY' zoom='4'__",
  "show:<div class="result">",
  "show:<div class="map" id="church__count__" style="width: 308px; height: 151px; margin-bottom: 10px"></div> __googlemap key='YOURGOOGLEMAPYEY' zoom='4' div='church__count__'__",
  "show:<h3>__name__</h3>",
  "show:<table>",
  "show:<tr><th>Address:</th><td>__street__ __city__, __stateAB__ __zip__</td></tr>",
  "show:<tr><th>Postal Address:</th><td>__postal__</td></tr>",
  "show:<tr><th>Phone:</th><td>__phone__</td></tr>",
  "show:<tr><th>Web site:</th><td><a href='http://__website__'>__website__</a></td></tr>",
  "show:<tr><th>Email:</th><td>__email__</td></tr>",
  "show:<tr><td colspan="2">__description__</td></tr>",
  "show:</table>",
  "show:</div>"
);
?>

Church Detail

Example<?php
   getContent(
    "church",
    "display:detail",
    "find:".$_GET['slug'],
    "show:<div class="result">",
    "show:<div class="map" id="church" style="width: 308px; height: 151px; margin-bottom: 10px"></div> __googlemap key='YOURGOOGLEMAPKEYHERE'' zoom='4' div='church'__",
    "show:<h3>__name__</h3>",
    "show:<table>",
    "show:<tr><th>Address:</th><td>__street__ __city__, __stateAB__ __zip__</td></tr>",
    "show:<tr><th>Postal Address:</th><td>__postal__</td></tr>",
    "show:<tr><th>Phone:</th><td>__phone__</td></tr>",
    "show:<tr><th>Web site:</th><td><a href='http://__website__'>__website__</a></td></tr>",
    "show:<tr><th>Email:</th><td>__email__</td></tr>",
    "show:<tr><td colspan="2">__description__</td></tr>",
    "show:</table>",
    "show:</div>"
);
?>

How to Display a Google Map of your Church Location

You will first need to create a church record:

http://my.ekklesia360.com/Church/list/

Then you will need a key from Googe in other to retrieve the data. Fill out this form and save the key returned. (don't worry, it only takes a second)

http://code.google.com/apis/maps/signup.html

 Then create this monklet and call it from any content.

{
tag="church"
display="detail"
find="your-church-name-slug"
show="<div class='map' id='churchMap' style='width: 308px; height: 151px; margin-bottom: 10px'></div>__googlemap key='YOUR-GOOGLE-MAP-KEY' zoom='11' div='churchMap'__"
}