In this chapter of our series, I’ll show how to implement a detail page for each ministry in the church. The detail page will provide a place to display contact info, show a photo, have paragraphs of text, and allow site visitors to leave comments. From an ExpressionEngine perspective, this chapter is very similar to the weblog comments template, but I will cover a new use of the weblog:entries tag to show related ministries to the one being viewed.
Between having already entered content and being able to use weblog/comments as our base, this template should be a fairly quick one to implement. If you want a sneak peek at the finished template you can get one here:
http://church.train-ee.com/index.php/ministries/details/crafty-old-people/
Here’s an overview of the process it will take to create that page:
- Create a new template
- Change the title & location
- Change the main content
- Change the sidebar
Create a New Template
The comments template has the basic two-column formatting that will work on this page, and the comments function will serve nicely as a way for the different ministries to allow members to post stories or cool happenings related to the ministry.
So create a new template in the ministries template group, call it “details”, and choose to copy weblog/comments as the basis for the code.
Change the Title and Location
The weblog/comments template has the following code that sets the page title:
{embed="embeds/html_header"
{!--The my_title value will always be used. --}
my_title="Weblog |
{!--This being a single entry page we just need the entry title --}
{exp:weblog:entries weblog="weblog" limit="1"
disable="custom_fields|trackbacks|member_data|pagination|categories"}
{title}
{/exp:weblog:entries}
"}
For ministries/details change it to:
{embed="embeds/html_header"
{!--The my_title value will always be used. --}
my_title="Ministries |
{!--This being a single entry page we just need the entry title --}
{exp:weblog:entries weblog="ministries" limit="1"
disable="custom_fields|trackbacks|member_data|pagination|categories"}
{title}
{/exp:weblog:entries}
"}
Then the main navigation active location needs to be changed. weblog/comments has:
{embed="embeds/main_nav" my_location="weblog"}
and this needs to change to:
{embed="embeds/main_nav" my_location="ministries"}
Change the Main Content
As usual I’ll provide the complete template at the end of this chapter, but here is the code for the main content area of the page. Give it a once-over, then I’ll walk through the significant parts.
<!--BEGIN CONTENT SECTION-->
<div class="interiorBox">
<h2>Ministries</h2>
<div class="content_page_right">
{!--This is the main weblog:entries tag that will return content for this ministry. --}
{exp:weblog:entries weblog="ministries"
disable="trackbacks|member_data|pagination" limit="1"}
<div class="post">
<h3>{title}</h3>
<img class="ministry_photo" src="{ministry_photo}" alt="{title}" />
{ministry_main_content}
</div>
{/exp:weblog:entries}
{embed="embeds/comments_form" the_weblog="ministries"}
</div>
<div class="content_page_left">
<div class="ministry_contact">
<h3>Ministry Contact:</h3>
{exp:weblog:entries weblog="ministries"
disable="trackbacks|member_data|pagination" limit="1"}
<p>{ministry_contact_name}<br/>
{ministry_contact_email}<br/>
{ministry_contact_phone}</p>
{/exp:weblog:entries}
</div>
<div class="navcontainer">
<h3>Related Ministries</h3>
<ul class="navlist">
{exp:weblog:entries weblog="ministries"
disable="trackbacks|pagination" related_categories_mode="on"}
<li><a href="{url_title_path=ministries/details}">{title}</a></li>
{/exp:weblog:entries}
</ul>
</div>
</div>
<div class="spacer"></div>
</div><!--END CONTENT SECTION-->
So overall, a very straightforward EE page here. The main content is pulled with the standard weblog:entries tag. Note that the image is pulled in using img tags in the template code vs. the weblog post providing them (a result of choosing the “url only” option while uploading):
<img class="ministry_photo" src="{ministry_photo}" alt="{title}" />
The benefit of this is that you can dynamically set the alt text using the weblog entry title. The downside is that you can’t easily specify an image height and width as your content administrators might upload an image of any size. Note that you can enforce a maximum height and width in the File Upload Preferences. Between the two I’d rather have nice alt text.
Next, check out the embed statement that brings in the commenting functionality. Now is when you start to realize the value of using the embedded approach for comments. All you need to do to add them to this template is change the weblog name that gets passed in, and voila!—formatted comments and the comments entry form are on your template just like that.
Past that, I have contact information being displayed in the sidebar. And yes - I am using another weblog:entries tag to content from the same post. While you can get carried away in that direction and end up with a template with alot of processing overhead, I’m not concerned with the load here. This coding approach is just easier to read and maintain than trying to use one weblog:entries tag.
Below that tag is another weblog:entries tag with a parameter I’ve not yet covered - the related_categories_mode. Essentially what I want to do here is show, for any given ministry, what other ministries are in the same category as the one being currently viewed (remember I set up the categories to be demographically-based). At the moment I only have two entries per category, so only one ministry will show in the related ministries list. Note that if you assign a given ministry to multiple categories then this tag will return more results - as it will return all categories related to any of the categories the current entry is assigned to.
I have more in mind for this template - I also want to display related events in the sidebar under related ministries. For that I’ll need to wait until the event calendar is implemented.
Companion Files
Included in this zip archive are ministries/details and an updated stylesheets/style:
16-Ministries-Details.zip
What’s Next?
In the next installment I’ll get started on the Worship section of the site.
Series Navigation
Next entry: 17 - Implementing the Worship Section
Previous entry: 15 - Beginning the Ministries Section
Previous Comments
Mike,
I note that it is possible to import data to the membership tables on EE. Is there a way to create a weblog and then populate it with an import file of any specification on EE?
Also, I am interested in having this ministries page have three categories of data according to our structure: ministries, groups, and teams. The last of these is pretty important, because it refers to cell groups, whereas the former two share more of the attributes of the items in your demo list OR are administrative. To put it another way, the categories we used to get at the list (kids, teens, single, men, women, seniors) is quite valuable in terms of how someone might want to search, so I want to keep that in place. But I really need to carve out the cells.
Would you simply replicate the whole structure and create a different weblog and duplicate/edit the templates, or can you imagine way to skin this cat?
Search the EE forums for either CSVee or CSVGrab - I can never recall which it is. Essentially it’s a plug in that allows import to a weblog from a comma separated value file.
For your structure either I’d probably look to use ministries, groups and teams as the categories (and then work in the “for men, for singles” etc as entry titles).
And I’d probably use “Groups” as the section name rather than Ministries. I’ve done that on a previous church site.
Note that you can have subcategories as well.
Add Your Comment
Latest Products
- Screencasts : Prepping an EE Site for Client Access
So you’ve been slaving away… More >> - Screencasts : Members-Only Content and Workflow
Do you have content that… More >> - Screencasts : Designing an ExpressionEngine Architecture
OK - so you’ve got… More >> - Products RSS Feed
- Products Email Notification
Checkout Requirements
In order to make a purchase from Train-ee you’ll need to first be registered and logged in, and you will also need a PayPal account.
Links to the downloadable files will be sent upon receipt of payment.
Note that if you pay with a credit or debit card and PayPal sees the transaction as an “eCheck”, there will be a 3-4 day delay before the transaction completes and you receive the download links.

Thanks again Michael. I was unaware of all the weblog entries tag paramaters. I’ve been struggling with the concepts for weblogs beyond the basics. Planning some categories in my own little dev project, and wondering what all EE could do. All of those are really powerful stuff.
There’s other great tidbits of info in there too.
Happy 4th of July also!