15 - Beginning the Ministries Section

Most churches have a variety of programs and groups geared towards outreach, getting members together, or working to benefit charities.  The somewhat churchy umbrella term for these things is “Ministries”.  It’s always nice to give each ministry a little home page of their own on a church site for marketing, schedules, photos, contact names, etc.  In this chapter I’ll cover the implementation of the sample church site’s Ministries index page on ExpressionEngine.

 
Download the EE Code for 15 - Beginning the Ministries Section

Overall this is a very straightforward implementation of EE.  The overall process is:

  • Create a Ministries weblog
  • Choose a template to base the section on
  • Decide what data elements will make up a Ministry page on the site
  • Create a Ministries field group
  • Create the fieldset
  • Create a Ministries category group
  • Enter content
  • Create a Ministries template group
  • Edit the new ministries/index template


Creating a Ministries Weblog
By now you should be able to get through this process on your own—just create a new weblog with a Full Weblog Name of Ministries and a Short Name of ministries.  Don’t create any new templates or template groups yet, just save it with the name set.

Choosing a Template
This may seem like a strange second step, but the design of the Ministries section can impact the required fields and content needed to populate it.  In my case I really like the idea of using the Staff Directory template for the Ministries index as it allows for a small thumbnail and text description along with the link.  It’s a nice looking layout and it would only get used on the Staff page if we don’t use it here.

Having made that choice starts to dictate the different pieces of content I’ll need for each ministry as the index template will require a title, short description and thumbnail.  Each entry here will then be linked to a detail template which will hold a larger text area for a full description of the ministry.  On that detail page I’ll also give them a spot for a larger photo, and a contact person with name, email and phone number fields.  I considered having the contact name appear on the index page, but fear that it would start to look too cluttered.

Creating a Ministries Field Group
With the template chosen and using it as a basis for determining what content will make up a ministry entry on the site, I can now move on to creating the fields necessary to hold that content.  First, however, you’ll need to create the parent field group container.  Create a new field group with a name of Ministries.

Creating the Fieldset
Add the following fields.  For each field I’ve listed the Field Name, Field Label, Field Type, Maxlength, Default Formatting, and Searchable settings.  You can choose to make fields required or not as you see fit (I tend to come back to finesse those settings right before handing over a site to a client):

  • ministry_index_thumbnail, Ministry Index Thumbnail, text input, 128 characters, no formatting, not searchable.
  • ministry_index_description, Ministry Index Description, text input, 100 characters, no formatting, searchable.
  • ministry_photo, text input, Ministry Photo, text input, 128 chars, no formatting, not searchable
  • ministry_main_content, Ministry Main Content, textarea, 20 rows, XHTML formatting, searchable.
  • ministry_contact_name, Ministry Contact Name, text input, 128 chars, no formatting, searchable.
  • ministry_contact_email, Ministry Contact Email, text input, 128 chars, no formatting, searchable
  • ministry_contact_phone, Ministry Contact Phone, text input, 128 chars, no formatting, searchable

This field group needs to be assigned to the Ministries weblog, but hold off on that until after the category group is in place and you can do both assignments at once.

Create Category Group - Ministries
Most churches have a small number of ministries and they tend to be targeted to different demographic groups - men, women, seniors, singles, teens etc.  I want site visitors to be able to filter down the overall list of ministries to find the ones that are more relevant to them, so will use EE categories again to do that task.

Creating a category group was covered in Chapter 12 so I won’t cover it again in detail - just follow those steps to creating a new category group called Ministries.

Once the group is in place you can fill in some categories.  Here’s the categories I’ve specified:

  • for Kids
  • for Men
  • for Seniors
  • for Singles
  • for Teens
  • for Women

I’ve specified a custom sort order such that kids are first and seniors are last.  I’ve entered short descriptions, but at this point don’t think they will be used.  I just want category links horizontally across the page on top of my ministry listings.

With the categories specified, I can now go ahead and connect the weblog to the field and category group.  If you’ve forgotten where to do this it’s under Weblog Management > Edit Groups.

Create New File Upload Destination for Ministry Images
With all the data structures in place, now is a good time to enter some content—this way when coding the template you’ll be able to tell your code is working correctly and the formatting is what you want.  In the fields for the new ministries section there are two fields for images - one for the thumbnail that appears on the index page and one for an image that will appear on the details page.  These images will need to be created and uploaded to the server during the content publishing process.

If you like to keep your images organized on the server based on where those images are used on a site, now is a good time to get a new folder in place for the ministry-related images and setup a specific file upload destination.  This step will also setup the site nicely for down the road when a new member group is created to manage the content.  Member groups can be mapped to file upload destinations which will work out nice as churches tend to delegate content administration by section of the site.

Create the folder on the server first by logging in via FTP.  I’ve created a ministries folder under the default images folder that EE installs with.  Make sure the folder is writable.

Now back in the EE Control Panel do the following

  • Navigate to Admin >  Weblog Administration >  File Upload Preferences
  • Click edit on the existing Upload Destination
  • Copy the server path
  • Go back a page to the File Upload index
  • Select “Create a New Upload Destination”
  • Paste the Server Path into “Server Path to Upload Directory”, making sure to edit it to specify your new folder name
  • Fill in the rest of the form as needed
  • I’m allowing all file types since some ministries might want to post PDF versions of permission slips etc.
  • I’m not applying any formatting or properties - I’d rather do that in the template
  • For now I’m not going to assign rights to this destination - I’ll catch it later
  • Submit the new Destination

Note - there have been times where I’ve had to work with the hosting provider to get the correct server path.  This is why I like to start by copying an existing one that’s working.  If you have issues here you might need to contact your host to verify the pathing requirements.

Publish Content
Now you’re ready to enter some content - for today’s purposes just make sure each ministry gets a 80x60 thumbnail image and a short description.  I filled in each ministry completely - also uploading a 325px by 300px image for the details page (remember to now choose your new File Upload Destination when uploading the images), greeking for the full content, and made-up contact names etc.

I’ve uploaded images with “URL Only” option - choosing to put the actual img src tags in the template code.  This will also allow me to pull the entry title and use it as the alt text for the image.  Publish a couple entries per category so you’ll be able to tell if category views work and format correctly.

Creating a Ministries Template Group
OK - time to get to the template coding.  By putting the ministries content in their own dedicated template group the URL’s will come out nicely - the index will be at:

http://yoursite.com/index.php/ministries/ 

and an individual ministry page will be at a URL along the lines of:

http://yoursite.com/index.php/ministries/detail/ministry-name 

I’ve covered creating a new template group already so you should be able to do that - just name it “ministries” and save it with the default blank index template.

Editing the Ministries Index Template
Let’s do the two-step in reverse again here where I show the code and then talk you through it.  As usual, I’ll also post this template in zip file below, along with the other updated templates needed for this chapter.  Here’s the template code that’s driving the completed Ministries Index page:

{embed="embeds/html_header" my_title="Ministries"}

<body id="ministries">
<
div id="wrapper">
{embed="embeds/page_header"}
{embed
="embeds/main_nav" my_location="ministries"}
    
<div class="clear"></div>
   
 <!--
BEGIN CONTENT SECTION-->
<
div class="interiorBox">
    <
h2>Ministries</h2>
    <
ul class="ministry_categories">

         
{!--Adds an obvious way to get back to the full list --}        
        
<li>
            <
a {if segment_3==""class="active" {/if} href="/index.php/ministries/">View All</a>&nbsp;&nbsp;|
        </
li>

        
{exp:weblog:categories weblog="ministries" style="linear"}
            
<li>
                 
{!--The conditional in this line will cause the link to the currently-viewed category to be highlighted --}                                
                
<a {if segment_3==category_url_title}class="active" {/if}href="{path=ministries/index}">{category_name}</a>

                 
{!--This conditional applies a separator bar to every link except the last --}                                
                {if count 
total_results}
                    
&nbsp;&nbsp;|
                
{/if}
            
</li>
        
{/exp:weblog:categories}
    
</ul>

    
{exp:weblog:entries weblog="ministries" disable="trackbacks|pagination|member_data" orderby="title" sort="asc"}
                
         {
!--The switch variable handles applying the required different css to every other entry --}            
        
<div class="{switch="staffBorder rtMargin|staffBorder"}">
            <
a href="{url_title_path=ministries/details}"><img src="{ministry_index_thumbnail}" width="80" height="60" alt="{title}" /></a>
            <
h4><a href="{url_title_path=ministries/details}">{title}</a></h4><br />
            
{ministry_index_description}<br />
        </
div>

    
{/exp:weblog:entries}

</div><!--END CONTENT SECTION-->

<
div class="clear"></div>
    
{embed="embeds/footer"}    

</div><!--END BODY WRAPPER-->
</
body>
</
html

The first couple of differences are easy to spot - I’ve just changed out the my_title and my_location variables to reflect the new purpose for this template.  Then the code moves into the category listing - which uses the same weblog categories tag as the church weblog code uses.  The only difference here is that I wanted a persistent “View All” link to show on the left (rather than having it only show after a category has been selected), so that code appears before the weblog categories tag.  A conditional applies the active class formatting if the URL doesn’t have any category indicators in it. 

Then there is the weblog categories tag which is pretty straightforward, again using a conditional to apply the active class to the chosen category. Note that, like the weblog/index, ministries/index will also function as the category view -so the category links are pointing right back to this same template.

But then there’s this little chunk of code:

{if count total_results}
    
&nbsp;&nbsp;|
{/if} 

There’s some new stuff here so let me explain.  Since the category names are going to appear horizontally (via some CSS rules I added to the stylesheet) I wanted separator bars between the links.  What I didn’t want is a bar after the last category link.  To prevent that I took advantage of two variables available within the weblog categories tag - count and total_results.  The logic here is that by using this conditional I can figure out when the last category in the list is being displayed and skip applying the separator bar.

Got that?

OK - let’s move to the weblog entries tag that handles building out the list of ministries.  The trick with this section of the page is that the source template uses two classes, and applies one to the entries that appear on the left:

<div class="staffBorder">
    <
img src="{site_url}images/interface/staff2.jpg" width="80" height="60" alt="pic" />
    <
h4>Exerci tation ullamcorper</h4><br />
    
Suscipit nisl ut aliquip ex ea commodo consequat velit esse molestie velit esse molestie
    <
a href="mailto:moujaesrm@church.org">moujaesr&amp;m@church.org</a
</
div

and applies both classes to the entries that appear on the right:

<div class="staffBorder rtMargin">
    <
img src="{site_url}images/interface/staff4.jpg" width="80" height="60" alt="pic" />
    <
h4>Vel illum dolore eu feugiat</h4><br />
    
Nulla facilisis at vero velit esse molestie consequat accumsan et iusto
    
Enim ad minim veniam quis nostrud exerci tation ullamcorper consequat
</
div

and it then has a spacer in between rows:

<div class="spacer"></div

How to handle this with ExpressionEngine?

The weblog entries tag has this handy little variable called switch.  Per the docs “This variable permits you to rotate through any number of values as the entries are displayed. The first entry will use “option_one”, the second will use “option_two”, the third “option_three”, the fourth “option_one”, and so on.”

So what I did was specify the div classes using switch :

<div class="{switch="staffBorder rtMargin|staffBorder"}"

That nicely handles getting the “rtMargin” class applied to just the ministry listings that need to appear on the right.

So now, how about that spacer?  That would need to go in between every two entries.  Rather than puzzle out some logic to go into the weblog entries tag I took the easy way out and added a bottom margin to the staffBorder class.  This let me just get rid of the spacer div altogether.  Less markup is a good thing, right? 

Let’s move on to the thumbnail code for a moment:

<a href="{url_title_path=ministries/details}"><img src="{ministry_index_thumbnail}"
 
width="80" height="60" alt="{title}" /></a

I wanted to highlight this, as earlier I said to use the “url only” option when uploading a photo.  This line of code shows the reason why - with just the url to the image (and not the full img src tag) coming from the weblog data I can use the entry title as a dynamic alt tag.

From there it’s all straightforward EE code - other than the fact that I’m pointing links to a ministries/detail template I haven’t created yet.  That will be the next step in the site development.

Just as a reminder the folder names in the attached files should match your template group names, and the text file names should match your template names.  Also—I haven’t covered the changes to embeds/main_nav - but it’s just updating the ministries link to be live and pointing to the new ministries/index template.

The next installment in the series will be detail pages for each ministry.  Until then—here’s a question: Should the detail pages for each ministry allow comments from site visitors?  It’s easy to do from an implementation perspective, but from a political/fear/what-if-someone-says-something-bad perspective it’s one of those decisions that might be tough to work through for your own church. 

Years ago I implemented a church site and allowed comments on the church’s mission statement.  The comment I got from a Pastor was “why would we allow anyone to comment or question that?”.  My response back was “What’s it worth if you can’t or won’t defend it?”

I’ll leave you to puzzle on that one…

 

Category Navigation

<< Previous Entry   

Next Entry >>

 

Previous Comments

Picture of tzTrainEE

by tzTrainEE

Date: Thursday, June 19th, 2008
Comment: #1

A certain amount of respect could be expected in the commenting but moderating a website is a learned skill, some comments just need deleted.

Did you experience any just plain rude comments that needed deleted then, Mike?

Some people have an axe to grind, not with a church I wouldn’t think. comments should be a plus sitewide. :)

Mike Boyink

by Mike Boyink (Author)

Date: Thursday, June 19th, 2008
Comment: #2

People are people and no matter the social context there will be rude people with axes to grind.

Whooboy - are there axes to grind in churches. 

Ask my pastor about what happened at a previous church when he decided to get an earring and grow a goatee.

I was less concerned with the need for moderation than I was the closed attitude towards even allowing comments to begin with.

Picture of parsoncraig

by parsoncraig

Date: Thursday, June 26th, 2008
Comment: #3

Thanks for this wonderful series.  I can’t wait to the next few installments.

I have a question that anticipates your work on the event calendar.  Is there a way to display the Events in some way other than a list?  Specifically, is there some way to display them in a monthly calendar control, such as the embeddable Google calendar?

Ideally, I would love to have my church secretary maintain the Events list using an actual calendar or in a highly simplified EE form that is uber-intuitive.

Instead of using EE (if it does not have a way to do this), I was thinking about using Google calendar and embedding it in a page.  What are your thoughts on how best to approach this?

My pastor really wants a calendar view of Events.

Mike Boyink

by Mike Boyink (Author)

Date: Thursday, June 26th, 2008
Comment: #4

Hi Craig - I’m running out, but the short answer is Yes

Picture of parsoncraig

by parsoncraig

Date: Thursday, June 26th, 2008
Comment: #5

Mike, I just interviewed my pastor on this issue of a calendar and have an updated question.

His focus is on the “duty roster” portion of a church calendar.

On 6 July 10:15 am service, Suzy is crucifer, Billy is acolyte, John is the lector, and David is usher. etc. etc.  When SuperSoccerMom visits the church website, how can she see those events where she has an assigned duty?  Or how can we have the system generate reminders or allow them to add events to their own calendars?  Or can she subscribe to or filter events such that she sees only those with which she has an ongoing interest as reflected in some profile or subscription records?

Picture of tzTrainEE

by tzTrainEE

Date: Thursday, June 26th, 2008
Comment: #6

hi Craig and Mike.
Just in case you didn’t guess then Craig, that’s an EE calendar, I ran the url through www.builtwith.com to be sure.
I bet Michael’s got the details, and whether that setup takes any add-on’s or anything.
Waiting to hear… but I think Michael mentioned using this add-on, I might be mistaken though.
EE Repeet:
http://lincolnite.com/ee/repeet
Check the example for the large calendar there.

Picture of parsoncraig

by parsoncraig

Date: Thursday, June 26th, 2008
Comment: #7

Thanks, tzTrainEE.  I do remember that he mentioned the Repeet plugin earlier in the series, but I had forgotten about it.  Thanks!

Mike Boyink

by Mike Boyink (Author)

Date: Thursday, June 26th, 2008
Comment: #8

Whoa - OK, let’s back up the bus a bit on the event calendar.

First - imagine a weblog. Now add an entry on the weblog.  It goes in with a publish date.  Some blogs have those little sidebar calendars that show you when posts were made.

Got it?  Now - blow up that small calendar to be full-page, and post some entries with future dates.  Throw the title of the post on the calendar view. Link it to another template that can show more details.

That’s the essential EE calendar capability.  It’s just a view of weblog posts plotted on a calendar view with the ability to show entries with future dates.

The repEEt module adds recurring events - so post an entry, and some details about how it repeats, and it shows on the full-page calendar view multiple times.

It’s not a staffing calendar - your scenario of people and email reminders etc is all way outside of what EE can do out of the box or even with the repEEt add-on.  You’re really into a different software application there…almost MSOutlook-ish just on the web. 

Possibly you could look at Google calendars, and having people setup their own and then add events to the Church’s calendar - but regardless, that’s all outside of ExpressionEngine.

Picture of parsoncraig

by parsoncraig

Date: Thursday, June 26th, 2008
Comment: #9

Thanks for the feedback, Mike.  Yeah, this is really relational database stuff: many events with many functions and many persons for those functions for each event, sometimes recurring….

It may be, however, that I can separate the two goals and tackle them in EE.  The calendar view has to do with events, and it seems clear now that EE can do that reasonably well.

But the duty roster things is a table consisting of job or function, name assigned, and date-event assigned.  Crucifer, acolyte, Eucharistic minister, lector, Usher, etc. It seems to me that EE could handle the display of those records as entries in a weblog.  It would be nice if you could somehow link those entries to another weblog of events since they share a common data element.

Mike Boyink

by Mike Boyink (Author)

Date: Friday, June 27th, 2008
Comment: #10

EE has the ability to define a relationship between weblog entries - although it’s not a full fledged RDMS in that respect it does allow alot of cool functionality.  However it is relationships between weblog entries and not relationships between user accounts and weblog entries.

If your duty roster has a relatively small number of positions then it might be do-able in EE (minus the email alerts or moving events to personal calendars etc).

I was applying my own church history - which may or may not be applicable - where on a given Sunday morning you would have anywhere from 50-100 volunteers in different capacities.  Trying to manage the amount of data that number of people would generate in EE just wouldn’t be the most efficient way to do it.

Picture of parsoncraig

by parsoncraig

Date: Friday, June 27th, 2008
Comment: #11

Mike,
You have more volunteers than we have worshippers at either service!  Actually, that’s not true, but we are not much larger.  So the scale is quite small.  If we were as large as your church, we no doubt could afford a robust solution.  Here, all I am seeking is an adequate solution.  I think the nice-to-haves of email alerts and creating ical downloads aren’t necessary to hit that goal.  But adding the ability to create an iCal record and download seems like an interesting enhancement for a plugin like repeet.

Mike Boyink

by Mike Boyink (Author)

Date: Friday, June 27th, 2008
Comment: #12

Heh - while that’s part of my church history, it’s not the case with my current church where we’re hitting ~100 people a week.

Picture of Mary Ellen Slater

by Mary Ellen Slater

Date: Sunday, November 9th, 2008
Comment: #13

Mike,

For my church we have 2 ministries that are slightly more unique in that they have a lot of information beyond the basic overview.

With the ministries section I was trying to add subpages for the “safe church policy”  specialty music pages and pages for the teachers and other ancillary pages using sub categories. I am able to turn off the child categories in the category link list but with the weblog entries tag when i use category=“not 45” it appears to mess up the category naivgation so that no matter what I click I get all the categories entries displaying in the little boxes.  http://medfield.pmhclients.com/index.php/ministries/

I guess the question is… is it better for me to pull the Music and children’s ministry out of the ministries section and create their own? I am trying to keep the workflow the same so that they do not get confused that is why I was using child categories but it seems like that messes up the regular category navigation.

Can i create seperate blogs for thos and have them pull into the same main ministries page? It seems like I should be able to do that. I am not sure if I am making this more complicated than it needs to be but these folks work too hard for me to turn over something that will be difficult to get their minds around.

Mike Boyink

by Mike Boyink (Author)

Date: Sunday, November 9th, 2008
Comment: #14

Hmm…tough to say without knowing more about the content.

Is it possible to divvy up the content so that rather than sub categories you just have more entries under the top-level categories?

Mike Boyink

by Mike Boyink (Author)

Date: Sunday, November 9th, 2008
Comment: #15

BTW - that’s an interesting take on the Church site templates.  Really brightens it up!

Picture of Sharon Brown

by Sharon Brown

Date: Wednesday, February 11th, 2009
Comment: #16

Hello Mike,

I’m not seeing the ministries folder under the default images folder that EE installs with.  I’m wanting to following your directions on creating a new file upload destination for the incoming images.

Can you help?

Thanks, 
Sharon

Mike Boyink

by Mike Boyink (Author)

Date: Wednesday, February 11th, 2009
Comment: #17

HI Sharon - you need to create that folder via FTP.

Picture of Brett

by Brett

Date: Thursday, March 19th, 2009
Comment: #18

Hi Mike.

Thanks for this tutorial… it’s a fantastic resource.

Quick comment about a small glitch I found in this lesson. I noticed that your body id tag for the ministries template is “staff.” I had to change this to “ministries” to get the header image working properly.

Mike Boyink

by Mike Boyink (Author)

Date: Monday, March 23rd, 2009
Comment: #19

Good catch - thanks!

Picture of Paul J

by Paul J

Date: Tuesday, May 5th, 2009
Comment: #20

Regarding the ....”“url only” option “

Okay…on the publish screen for ministries, I see the “Upload File”. I assume using the “Upload File” link is how one would upload the ministry photos to go along with the new ministry entry?
Clicking on this pops up a window to browse for a file, along with an Upload Button. I’m not seeing this “url only” option, or any options for that matter. Is this a setting I must turn on somewhere ?

How can I go about getting the URL Only? Or am I missing something? Thanks!

Mike Boyink

by Mike Boyink (Author)

Date: Tuesday, May 5th, 2009
Comment: #21

Hey Paul -

Upload a file, and then you will get options for how to place it in the entry, one of which is url only.

Picture of Paul J

by Paul J

Date: Tuesday, May 5th, 2009
Comment: #22

Mike,

thank you. I should have tried that before posting. Always the no-brainer things that get me. Thanks again.

Add Your Comment

Commenting is not available in this channel entry.

Unless otherwise stated all content is © Michael Boyink of Train-ee.com & Boyink Interactive. Please don't steal - I've got kids to feed...

dy>