<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

    <channel>
    
    <title>Train&#45;ee.com Weblog</title>
    <link>http://www.train-ee.com</link>
    <description>Learn ExpressionEngine Fast!</description>
    <dc:language>en</dc:language>
    <dc:creator>eeforme@train-ee.com</dc:creator>
    <dc:rights>Copyright 2008</dc:rights>
    <dc:date>2008-08-05T15:28:58-05:00</dc:date>
    <admin:generatorAgent rdf:resource="http://expressionengine.com/" />
    

    <item>
      <title>Classroom Training Now Available from Train&#45;ee!</title>
      <link>http://www.train-ee.com/courseware/free_tutorials/comments/classroom-training-now-available-from-train-ee/</link>
      <guid>http://www.train-ee.com/courseware/free_tutorials/comments/classroom-training-now-available-from-train-ee/#When:21:35:52Z</guid>
	<description>
		<![CDATA[
			<p>I&#8217;m excited to announce that Train-ee is now offering the first &#8220;open to the public&#8221; traditional classroom training for <a href="http://www.expressionengine.com/index.php?affiliate=boyink">ExpressionEngine</a>.
</p> <p>Well - at least it will be traditional in the sense that there will be four days spent in a classroom learning EE hands-on from an experienced professional, with the ability to ask questions and interact with others in the room.
</p>
<p>
That&#8217;s where any similarity to off-site training you&#8217;ve had in the past will (hopefully) end.&nbsp; 
</p>
<p>
The first difference is the location.&nbsp; This class will be held in a vacation destination - a scenic resort town nestled close to Lake Michigan and renowned for it&#8217;s beautiful sunsets, clean beaches, bikepaths and an historic downtown with home-town coffee shops and microbreweries.
</p>
<p>
The second difference is the venue.&nbsp; We&#8217;ve all suffered through training in an instantly forgettable generic space.&nbsp; Learn ExpressionEngine in a brand-new, funky, hip and green hotel located within walking distance of restaurants and shopping.
</p>
<p>
The third difference is the after-hours activities.&nbsp; Rather than leaving you to while away the evenings alone in your hotel room, we&#8217;re planning a number of events to get you out to experience the area and hang out with the others in the class.
</p>
<p>
For more information on the location, venue, course content, and schedule/cost please visit the new <a href="http://www.train-ee.com/courseware/classroom/">classroom</a> section here on Train-ee.com.
</p>
<p>
If you have any questions not answered by that page please feel free to contact me directly via either Train-ee or Boyink.com
</p>
<p>
Sign up now - the conference room is only so big!
</p>
		]]>
	</description>       

      <dc:subject>Train&#45;ee News</dc:subject>
      <dc:date>2008-07-16T21:35:52-05:00</dc:date>
    </item>

    <item>
      <title>23 &#45; Pulling Events to the Home Page</title>
      <link>http://www.train-ee.com/courseware/free_tutorials/comments/23-pulling-events-to-the-home-page/</link>
      <guid>http://www.train-ee.com/courseware/free_tutorials/comments/23-pulling-events-to-the-home-page/#When:15:28:58Z</guid>
	<description>
		<![CDATA[
			<p>Continuing with the events theme, this chapter looks at pulling church event information to the site&#8217;s home page.&nbsp; While I&#8217;m there I&#8217;ll also replace the Mission Statement area with the latest posts from the Weblog, as I don&#8217;t think mission statements are the best use of home page real estate - ever.&nbsp; New coding approaches covered in this chapter include the use of plugins - which will allow the reuse of content while keeping the site design happy.&nbsp; I&#8217;ll also use a new parameter on the weblog entries tag - the <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/parameters.html#par_start_on">start_one</a> parameter.
</p> <p><strong>First, an Editorial Decision</strong>
<br />
As the template came designed it had left-column space for an event title, short description and an image.&nbsp; While this is certainly do-able with EE, I&#8217;ve decided to eliminate the image.
</p>
<p>
Why?
</p>
<p>
Well - past experience.
</p>
<p>
If I implement an image for events here&#8217;s what will happen: the person wanting to get the event posted on the site won&#8217;t have an image available, or it will be the wrong size and format, or they will provide a cheesy clip art or <a href="http://www.virtualartroom.com/word_wordart.htm" title="http://www.virtualartroom.com/word_wordart.htm">Microsoft Word Art</a> abomination that will do nothing but distract from the overall site look and feel.&nbsp; I&#8217;m not sure what it is about the church environment that engenders this sort of &#8220;creativity;&#8221; but, if I never see a church bulletin or website filled with poor-quality squished and stretched words running in all different directions on the page, it&#8217;ll be too soon.
</p>
<p>
Actually - I&#8217;ve already created the opportunity for this situation on the ministry detail pages by allowing images there. For that matter any time a content administrator is allowed in to the EE Control Panel to enter text they&#8217;ll usually be able to upload images as well.
</p>
<p>
<strong>Tip: Create Guidelines</strong>
<br />
Put together some editorial guidelines for the site and go over them with each content contributor.&nbsp; Schedule regular meetings if need be.&nbsp; Do whatever it takes to communicate to this group that the intent of the website is to tell the church story, and the God story, in a professional manner to visitors.&nbsp; Part of doing the job in a high-quality way is to not use low-quality graphics that come out of tools like Microsoft Word.&nbsp; 
</p>
<p>
If your church is large enough I&#8217;d recommend appointing a graphic designer - someone the others can go to when they need some sort of imagery.&nbsp; The goals here are graphics that are high quality, consistent, and inline with the overall site design.&nbsp; Also appoint a site editor - someone who has the authority to say &#8220;no, sorry&#8221; to a cruddy graphic. Think of this person as a gardener  - someone with a loving vision for this space but willing to pull weeds, pinch dead leaves, and prune growth that&#8217;s heading in the wrong direction.
</p>
<p>
It won&#8217;t be an easy chore - in many churches the leaders of individual departments or ministries are used to generating their own marketing materials and doing so without any kind of guidelines or approval processes.&nbsp; The results, however, speak for themselves.&nbsp; Walk through the entryway of many churches and pick up a sample of all the different pieces of literature being set out - and you&#8217;ll probably find there is no consistency in colors/fonts/logo treatment, etc.&nbsp; I&#8217;ve seen cases where the church name wasn&#8217;t even consistently used.&nbsp; Church websites are typically no different.&nbsp; Do what you can to change that.
</p>
<p>
OK - enough of Mike&#8217;s ranting. 
</p>
<p>
<strong>Overall Approach</strong>
<br />
<ul><li>Update embeds/events to replace static content with EE code to pull events dynamically</li>
<li>Update site/index to replace mission statement with EE code to pull weblog entries</li></ul>
<p>
<strong>Updating embeds/events</strong>
<br />
First - remember that I created an embedded template from this code in case I wanted to use it multiple times across the site.&nbsp; I&#8217;m still uncertain if that will happen - so for now I&#8217;ll leave it embedded.&nbsp; If it ends up only being used on the home page I&#8217;ll just move the code back to live in site/index again.
</p>
<p>
Here is the new code - 
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"events"</span><span style="color: #007700">&gt;&lt;!--</span><span style="color: #0000BB">BEGIN EVENTS SECTION</span><span style="color: #007700">--&gt;<br /></span><span style="color: #0000BB">&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries weblog</span><span style="color: #007700">=</span><span style="color: #DD0000">"events" </span><span style="color: #0000BB">limit</span><span style="color: #007700">=</span><span style="color: #DD0000">"5" </span><span style="color: #0000BB">disable</span><span style="color: #007700">=</span><span style="color: #DD0000">"categories|trackbacks|pagination|member_data" <br /></span><span style="color: #0000BB">dynamic</span><span style="color: #007700">=</span><span style="color: #DD0000">"off" </span><span style="color: #0000BB">start_on</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;current_time format='%Y-%m-%d %g:%i %A'&#125;" </span><span style="color: #0000BB">show_future_entries</span><span style="color: #007700">=</span><span style="color: #DD0000">"yes" </span><span style="color: #0000BB">sort</span><span style="color: #007700">=</span><span style="color: #DD0000">"asc"</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">h4</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;url_title_path=events/details&#125;"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;title&#125; on &#123;entry_date format</span><span style="color: #007700">=</span><span style="color: #DD0000">"%M %d"</span><span style="color: #0000BB">&#125; </span><span style="color: #007700">&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;@</span><span style="color: #0000BB">&#123;entry_date format</span><span style="color: #007700">=</span><span style="color: #DD0000">"%g:%i%A"</span><span style="color: #0000BB">&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">h4</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">word_limit total</span><span style="color: #007700">=</span><span style="color: #DD0000">"10"</span><span style="color: #0000BB">&#125;&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">html_strip&#125;&#123;event_details&#125;&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">html_strip&#125;&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">word_limit&#125;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">br </span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">br </span><span style="color: #007700">/&gt;<br /></span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries&#125;<br /><br /></span><span style="color: #007700">&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;path=events&#125;" </span><span style="color: #007700">class=</span><span style="color: #DD0000">"redBglink"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Complete Event Calendar </span><span style="color: #007700">&amp;</span><span style="color: #0000BB">raquo</span><span style="color: #007700">;&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">; <br />&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"newsletters.html" </span><span style="color: #007700">class=</span><span style="color: #DD0000">"redBglink"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Newsletter Signup </span><span style="color: #007700">&amp;</span><span style="color: #0000BB">raquo</span><span style="color: #007700">;&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">b</span><span style="color: #007700">&gt; <br /><br />&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;&lt;!--</span><span style="color: #0000BB">END EVENTS SECTION</span><span style="color: #007700">--&gt;</span>
</code></div><p>
</p>
<p>
Let&#8217;s tackle the weblog:entries tag first.&nbsp; After specifying the events weblog I have it limited to only showing 5 entries.&nbsp; This might change depending on how the home page progresses - I&#8217;ll show more or fewer events in order to keep the design holding together.
</p>
<p>
After that is the disable parameter - always a good idea to turn things off that you don&#8217;t need for performance reasons.
</p>
<p>
The dynamic="off" ensures that this tag won&#8217;t try to read anything from the URL.&nbsp; The URL for the home page should never contain a url_title that would confuse this tag, but again it&#8217;s just a good habit to get into.
</p>
<p>
Skipping the start_on for the moment, the show_future_entries is required here; otherwise only events from today and older will show.
</p>
<p>
Events are sorted &#8220;asc&#8221; in order to get the one happening soonest to be first.
</p>
<p>
OK - now back to that start_on parameter.&nbsp; This might be flogging the obvious, but I don&#8217;t want to show any past events.&nbsp; I want them to drop off the home page as soon as they pass.&nbsp; In order to achieve that, I can use the start_on parameter.&nbsp; However, this can&#8217;t be a fixed date, it has to be a rolling start date such that it&#8217;s always starting on the current date.&nbsp; In order to do that the current_time global variable is used as a value for the parameter.&nbsp; Note that code is straight from the <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=/docs/modules/weblog/parameters.html#par_start_on">EE Docs</a>.
</p>
<p>
With the weblog:entries tag now configured let&#8217;s move on.&nbsp; The h4 tags are straightforward - just displaying the entry title and date/time using some <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/templates/date_variable_formatting.html">date formatting</a>.
</p>
<p>
Next up is displaying the event details, and this is where I&#8217;ve used some plugins.
</p>
<p>
<strong>What&#8217;s a Plugin?</strong>
<br />
<a href="http://www.expressionengine.com/index.php?affiliate=boyink">ExpressionEngine</a> was designed to be modular, which would allow both EllisLab and 3rd parties to extend its functionality in different ways.&nbsp; There are basically three different ways to add functionality to ExpressionEngine - plugins, modules, or extensions.&nbsp; What&#8217;s the difference?&nbsp; The <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=/knowledge_base/article/what_is_the_difference_between_a_plugin_a_module_and_an_extension/">EE KnowledgeBase</a> has this to say:
<br />
<blockquote><p>
Plugins are small run-time enhancements. They are simple to create and free to be distributed. The plugin architecture is designed to enable you to affect the output of ExpressionEngine in a wide variety of ways. 
</p>
<p>
Modules are larger systems that can be integrated into the ExpressionEngine control panel. Almost anything that can be achieved as a stand-alone application can be designed as an ExpressionEngine module. 
</p>
<p>
Extensions are &#8220;hooks&#8221; in the system that allow you to pass information and add functionality to existing interfaces (like the Publish page for example). 
<br />
</p></blockquote>
<p>
So - why plugins here?
</p>
<p>
In short - to get EE to return weblog contents in a form that the template was designed around.
</p>
<p>
Here is the event code coming into this chapter:
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">img src</span><span style="color: #007700">=</span><span style="color: #DD0000">"images/events-pic1.jpg" </span><span style="color: #0000BB">alt</span><span style="color: #007700">=</span><span style="color: #DD0000">"pic 1" </span><span style="color: #0000BB">width</span><span style="color: #007700">=</span><span style="color: #DD0000">"300" </span><span style="color: #0000BB">height</span><span style="color: #007700">=</span><span style="color: #DD0000">"60"</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">h4</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Duis autem vel eum</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">h4</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">Vulputate velit esse molestie consequat</span><span style="color: #007700">, </span><span style="color: #0000BB">vel illum eu feugiat nulla</span><span style="color: #007700">. &lt;</span><span style="color: #0000BB">br</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">br</span><span style="color: #007700">&gt;</span>
</code></div><p>
</p>
<p>
I&#8217;ve dropped the image, which would leave:
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">h4</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Duis autem vel eum</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">h4</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">Vulputate velit esse molestie consequat</span><span style="color: #007700">, </span><span style="color: #0000BB">vel illum eu feugiat nulla</span><span style="color: #007700">. &lt;</span><span style="color: #0000BB">br</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">br</span><span style="color: #007700">&gt;</span>
</code></div><p>
</p>
<p>
The h4 tag is being filled with the title and date code, so that&#8217;s set.&nbsp; This leaves the description blurb:
<br />
</p><div class="codeblock"><code>
<span style="color: #0000BB">Vulputate velit esse molestie consequat</span><span style="color: #007700">, </span><span style="color: #0000BB">vel illum eu feugiat nulla</span><span style="color: #007700">. &lt;</span><span style="color: #0000BB">br</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">br</span><span style="color: #007700">&gt;</span>
</code></div><p>
</p>
<p>
There are two constraints with this code.&nbsp; First is the length - if I plug the event_description field in directly, the events area would quickly trash our home page design because the event_description will likely have multiple paragraphs of text (and possibly images).
</p>
<p>
Second, this code is not marked up with paragraph tags, and the event_description field is set to a format of &#8220;XHTML&#8221;, which means its content will be returned marked up paragraph tags.
</p>
<p>
What to do?
</p>
<p>
One solution would be to create a custom field just for this purpose.&nbsp; You could limit its length and set the formatting to &#8220;none&#8221; and be done.&nbsp; However, that creates another chunk of content that has to be created and entered for each event, and I like to reuse content where possible.
</p>
<p>
So - it&#8217;s plugins to the rescue. If you are new to using plugins, you can get an overview of them in the <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=/docs/templates/plugins.html">documentation</a>.&nbsp; There is also a <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=/downloads/addons/category/plugins/">list of available plugins</a> on ExpressionEngine.com.&nbsp; The list is the &#8220;official repository&#8221; - you&#8217;ll also find plugins in the EE forums.&nbsp; My recommendation is to only use what you find in the list as they should be more reliable and offered by more reliable providers than what you might find in the wild.
</p>
<p>
I&#8217;ve used two that should be installed by default in EE, but if not you can find them in the library (installation instructions found at the above link):
</p>
<p>
<a href="http://expressionengine.com/downloads/details/html_strip/">HTML Strip</a>
<br />
<a href="http://expressionengine.com/downloads/details/word_limiter/">Word Limiter</a>
</p>
<p>
Note that these are both &#8220;first-party&#8221; plugins, which means they were created by the EE programmers.&nbsp; This means they should be safe to use, won&#8217;t break with future upgrades, and are eligible for support in the EE forums.
</p>
<p>
So let&#8217;s look at that line of code again:
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">word_limit total</span><span style="color: #007700">=</span><span style="color: #DD0000">"10"</span><span style="color: #0000BB">&#125;&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">html_strip&#125;&#123;event_details&#125;&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">html_strip&#125;&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">word_limit&#125;</span>
</code></div><p>
</p>
<p>
It&#8217;s easiest to visualize this in an &#8220;inside-out manner&#8221;.&nbsp; First take the contents of event_details and return them.&nbsp; Then strip the HTML - so the p tags are removed.&nbsp; Then, limit the words returned to 10.&nbsp; Note that you can change the parse order (or order in which the plugins are evaluated) if need be - the <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=/docs/templates/plugins.html">Using Plugins</a> page has the details on how to do that.&nbsp; I will say that I&#8217;ve only ever needed to do that once.
</p>
<p>
<strong>Results</strong>
<br />
You can view the <a href="http://church.train-ee.com/">rendered index page</a>, but here also is the rendered code for one event now:
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">h4</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://church.train-ee.com/index.php/events/details/picnic-in-the-park/"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Picnic in the Park on Aug 17 </span><span style="color: #007700">&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;@</span><span style="color: #0000BB">10</span><span style="color: #007700">:</span><span style="color: #0000BB">00AM</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">h4</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">Nam erat magna</span><span style="color: #007700">, </span><span style="color: #0000BB">malesuada ut</span><span style="color: #007700">, </span><span style="color: #0000BB">suscipit in</span><span style="color: #007700">, </span><span style="color: #0000BB">porta interdum</span><span style="color: #007700">, </span><span style="color: #0000BB">dolor</span><span style="color: #007700">.&amp;</span><span style="color: #FF8000">#8230;&lt;br /&gt;<br /></span><span style="color: #007700">&lt;</span><span style="color: #0000BB">br </span><span style="color: #007700">/&gt;</span>
</code></div><p>
</p>
<p>
Aha - now I&#8217;m getting content returned in a manner that the templates were designed around, while not increasing my content entry workload.&nbsp; This is what good content management is all about.
</p>
<p>
Now I will say - the home page is less interesting without the images for each event.&nbsp; I&#8217;m thinking when I get to the gallery implementation I&#8217;ll come back and add some &#8220;latest photos&#8221; thumbnails to the home page  - just for another splash of imagery.&nbsp; But for now it&#8217;ll do.
</p>
<p>
Oh&#8212;you can update the link to the full event calendar while you&#8217;re here.&nbsp; The code is:
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;path=events&#125;" </span><span style="color: #007700">class=</span><span style="color: #DD0000">"redBglink"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Complete Event Calendar </span><span style="color: #007700">&amp;</span><span style="color: #0000BB">raquo</span><span style="color: #007700">;&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;</span>
</code></div><p>
</p>
<p>
Cool?&nbsp; Cool.
</p>
<p>
<strong>Adding Weblog Posts </strong>
<br />
You&#8217;re over the hump now - pulling weblog entries to the home page is a simple matter.&nbsp; Here&#8217;s the new chunk of code:
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Weblog Latest</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">ul </span><span style="color: #007700">class=</span><span style="color: #DD0000">"home_page_blog"</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries weblog</span><span style="color: #007700">=</span><span style="color: #DD0000">"weblog" </span><span style="color: #0000BB">limit</span><span style="color: #007700">=</span><span style="color: #DD0000">"2" </span><span style="color: #0000BB">disable</span><span style="color: #007700">=</span><span style="color: #DD0000">"trackbacks|pagination" </span><span style="color: #0000BB">dynamic</span><span style="color: #007700">=</span><span style="color: #DD0000">"off"</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #007700">&lt;</span><span style="color: #0000BB">li</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;url_title_path=weblog/comments&#125;"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;title&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"post_meta"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">By &#123;url_or_email_as_author&#125;&nbsp;&nbsp;on &#123;entry_date format</span><span style="color: #007700">=</span><span style="color: #DD0000">'%F %d, %Y'</span><span style="color: #0000BB">&#125; in <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;categories&#125; </span><span style="color: #007700">&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;path=weblog/index&#125;"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;category_name&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt; &amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">categories&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;if allow_comments&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">&#123;comment_total&#125;</span><span style="color: #007700">) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;url_title_path=weblog/comments&#125;#comments"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Comments</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">if&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">li</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries&#125;<br /></span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">ul</span><span style="color: #007700">&gt;</span>
</code></div><p>
</p>
<p>
Nothing new to see here - I&#8217;ve just whittled it down to two posts and used some existing CSS styles for formatting.&nbsp; 
</p>
<p>
<strong>Companion Files</strong>
<br />
And - we&#8217;re done for this chapter!&nbsp; You can view the updated home page at:&nbsp; <a href="http://church.train-ee.com">http://church.train-ee.com</a>.
</p>
<p>
Here are the companion files - which include updated embeds/events and site/index templates:
<br />
<a href="http://www.train-ee.com/church/companion_files/23-Events-to-Home.zip">23-Events-to-Home.zip</a>
</p>
<p>
Looks like the photo gallery is next!
</p>
		]]>
	</description>       

      <dc:subject>Building a Church Site</dc:subject>
      <dc:date>2008-08-05T15:28:58-05:00</dc:date>
    </item>

    <item>
      <title>Training Scholarships Now Available</title>
      <link>http://www.train-ee.com/courseware/free_tutorials/comments/training-scholarships-now-available/</link>
      <guid>http://www.train-ee.com/courseware/free_tutorials/comments/training-scholarships-now-available/#When:19:30:31Z</guid>
	<description>
		<![CDATA[
			<p>Just in case you missed it - due to some very generous sponsors, there are now scholarships available for the Train-ee ExpressionEngine classroom training in September.&nbsp; You can view the details and entry requirements on <a href="http://expressionengine.com/events/trainee/">ExpressionEngine.com</a>.
</p> 
		]]>
	</description>       

      <dc:subject>Train&#45;ee News</dc:subject>
      <dc:date>2008-07-31T19:30:31-05:00</dc:date>
    </item>

    <item>
      <title>22 &#45; Displaying Related Events on Ministry Pages</title>
      <link>http://www.train-ee.com/courseware/free_tutorials/comments/22-displaying-related-events-on-ministry-pages/</link>
      <guid>http://www.train-ee.com/courseware/free_tutorials/comments/22-displaying-related-events-on-ministry-pages/#When:13:53:40Z</guid>
	<description>
		<![CDATA[
			<p>One distinct advantage of using native <a href="http://www.expressionengine.com/index.php?affiliate=boyink">ExpressionEngine</a> functionality for a church event calendar is that the event information can be pushed and pulled to different parts of the site.&nbsp; In this chapter I&#8217;ll show how to display upcoming events on the Ministry detail pages.&nbsp; New EE functionality this chapter covers will be the <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/reverse_related_entries.html">reverse related entries</a> tag.
</p> <p>So - at this point I&#8217;ve a relationship established between an event and a ministry.&nbsp; The event detail page is showing a link to &#8220;sponsoring ministry&#8221;, but I also want the ministry detail pages to show links to &#8220;upcoming events&#8221;.&nbsp; From an individual ministry point of view this provides them a nice little mini home page with all the important information someone would want to know.
</p>
<p>
<strong>Adding Events to Ministries Detail</strong>
<br />
 If you look at the updated <a href="http://church.train-ee.com/index.php/ministries/details/crafty-old-people/">Crafty Old People</a> ministry page, you&#8217;ll see that the left column now has &#8220;Upcoming Events&#8221;.&nbsp; These link to the event detail page, and are only the events that are sponsored by the Crafty Old People.
</p>
<p>
I&#8217;ll provide the complete updated template in the companion files below, but in the mean time here is the code that&#8217;s pulling those events in.&nbsp; Give it a once-over then I&#8217;ll hit the specifics:
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries weblog</span><span style="color: #007700">=</span><span style="color: #DD0000">"ministries" <br /></span><span style="color: #0000BB">disable</span><span style="color: #007700">=</span><span style="color: #DD0000">"trackbacks|member_data|pagination" </span><span style="color: #0000BB">limit</span><span style="color: #007700">=</span><span style="color: #DD0000">"1"</span><span style="color: #0000BB">&#125;<br /><br /></span><span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"ministry_contact"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Ministry Contact</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;ministry_contact_name&#125;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">br</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;ministry_contact_email&#125;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">br</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;ministry_contact_phone&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br /><br />&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"navcontainer"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Upcoming Events</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">ul </span><span style="color: #007700">class=</span><span style="color: #DD0000">"navlist"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;reverse_related_entries sort</span><span style="color: #007700">=</span><span style="color: #DD0000">"asc" </span><span style="color: #0000BB">weblog</span><span style="color: #007700">=</span><span style="color: #DD0000">"events"</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#123;if no_reverse_related_entries&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">li</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">No Events are Scheduled</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">li</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">if&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;if entry_date </span><span style="color: #007700">&gt; </span><span style="color: #0000BB">current_time&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">li</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;url_title_path=events/details&#125;"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;title&#125; </span><span style="color: #007700">- </span><span style="color: #0000BB">&#123;entry_date format</span><span style="color: #007700">=</span><span style="color: #DD0000">"%F %d"</span><span style="color: #0000BB">&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">li</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">if&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">reverse_related_entries&#125;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">ul</span><span style="color: #007700">&gt;<br />&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br /><br /></span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries&#125;</span>
</code></div><p>
</p>
<p>
So nested in a weblog:entries tag is the <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/reverse_related_entries.html">reverse_related_entries</a>.&nbsp; Why reverse_related and not <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/related_entries.html">related_entries</a>?
</p>
<p>
If you remember - the relationship field that ties these two content types together is in the Event weblog.&nbsp; That makes an event the parent and the ministry is the child.&nbsp; Since in this code I&#8217;m in a weblog:entries tag that is specifying the child (Ministry) weblog, I need to use reverse_related_entries to pull parent (Event) information.
</p>
<p>
With me?
</p>
<p>
So it&#8217;s the reverse_related_entries tag and within that tag I need to specify the parent (Events) weblog.&nbsp; Keep in mind that you might have multiple content relationships - so the tag needs to know where to look in this case.&nbsp; Since I&#8217;m dealing with date-related content, I&#8217;ve specified a sort such that the next upcoming event is listed first.
</p>
<p>
Now - it&#8217;s a given that not all ministries will have events.&nbsp; So I&#8217;m using the &#8220;if no_reverse_related_entries&#8221; conditional to look for that case and display a message if so.&nbsp; You might include a link to &#8220;view all other events&#8221; here if you want.
</p>
<p>
Now I have the following code:
<br />
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;if entry_date </span><span style="color: #007700">&gt; </span><span style="color: #0000BB">current_time&#125;</span>
</code></div><p>
</p>
<p>
What I didn&#8217;t want was events that had already passed to show in this list.&nbsp; This code compares the date of the event to a Standard Global Variable called <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/templates/globals/single_variables.html#var_current_time">current_time</a>.&nbsp; If the entry date is larger (further out) than the current time the event displays.
</p>
<p>
Honestly, this isn&#8217;t ideal.&nbsp; You&#8217;ll see in the next chapter that with the weblog:entries tag there is a better way to limit its results to just the entries in the future.&nbsp; It&#8217;s called the <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/parameters.html#par_start_on">start_on</a> parameter.&nbsp; However - it&#8217;s not available as a parameter on reverse_related_entries.&nbsp; There is a <a href="http://expressionengine.com/forums/viewthread/69738/">feature request</a> that you can add your support to if you want.
</p>
<p>
So what&#8217;s this mean?&nbsp; If a ministry had events, but they&#8217;re all in the past, the if_no_results won&#8217;t trigger as it&#8217;s not looking at date.&nbsp; The code will then proceed to try and list the events.&nbsp; The second conditional will evaluate to true for all events, so the result will be an empty list with no &#8220;sorry Charlie&#8221; message for the user.
</p>
<p>
One option is to close out past events&#8212;as reverse_related_entries will honor status and not pull those.&nbsp; But that strips history from your site as then those events won&#8217;t show on the master calendar.&nbsp; Taking that approach further you could configure the master events calendar and detail pages to pull entries with either an open or closed status - so closed events would come off the ministry detail pages but still show in other spots on the site.&nbsp; For my purposes I&#8217;m going to leave things as-is - there&#8217;s always the hope that EE 2.0 will have extended relationship handling (and for the record&#8212;I don&#8217;t know!).
</p>
<p>
In the next chapter I&#8217;ll cover pulling events to the home page.&nbsp; I had intended to include it here - but as part of displaying the event information I&#8217;ll need to use a couple of plugins.&nbsp; I haven&#8217;t yet covered plugins in this series so I&#8217;ll break that out into its own chapter.
</p>
<p>
<strong>Companion Files</strong>
<br />
Just one for this chapter - an update ministries/detail.
<br />
<a href="http://www.train-ee.com/church/companion_files/22-Events-to-Ministries.zip">22-Events-to-Ministries.zip</a>
</p>
		]]>
	</description>       

      <dc:subject>Building a Church Site</dc:subject>
      <dc:date>2008-07-31T13:53:40-05:00</dc:date>
    </item>

    <item>
      <title>21 &#45; Implementing the Event Calendar Details Template</title>
      <link>http://www.train-ee.com/courseware/free_tutorials/comments/21-implementing-the-event-calendar-details-template/</link>
      <guid>http://www.train-ee.com/courseware/free_tutorials/comments/21-implementing-the-event-calendar-details-template/#When:14:26:17Z</guid>
	<description>
		<![CDATA[
			<p>In this chapter I&#8217;ll cover the implementation of the Event Details template.&nbsp; This is the template that will load when a site visitor clicks an event title on the default calendar view, and will display the rest of the information about the event.&nbsp; New <a href="http://www.expressionengine.com/index.php?affiliate=boyink">ExpressionEngine</a> functionality covered in this chapter is the display of related entries.&nbsp; In our case this will mean displaying the name of the ministry group that is sponsoring the event, and linking ministry name to the ministry detail page.
</p> <p><strong>Where I&#8217;m Headed:</strong>
<br />
With the <a href="http://church.train-ee.com/index.php/events/">Calendar Index</a> in place, I now need to have those event title links go somewhere, and a place to display all the remaining content for the event.&nbsp; You can get a preview of where I&#8217;m headed by viewing the <a href="http://church.train-ee.com/index.php/events/details/picnic-in-the-park/">finished result</a> of the calendar details template.
</p>
<p>
This template will serve the following purposes:
<br />
<ul>
<li>It will display the complete event information.</li>
<li>It will allow site visitors to comment on the event - questions beforehand or reviews afterwards.</li>
<li>The comments could also be used as an informal event RSVP - just by asking people to post a quick comment if they intend on coming.</li>
<li>It will serve as a link target for other places on the site that will display events (the home page and on ministry detail pages).</li>
<li>It will link to the sponsoring ministry for the event.</li></ul>
<p>
<strong>The Steps</strong>
<br />
I already have the basic weblog, template group and content entered&#8212;so this chapter should be pretty quick and easy.&nbsp; Here are the overall steps:
</p>
<ul><li>Create a events/details template</li>
<li>Copy ministries/details as a starting point</li>
<li>Tweak the title and location indicators</li>
<li>Change content area code</li>
<li>Update events/index to add links</li>
</ul>
<p>
<strong>Create events/details</strong>
<br />
Create a new template in your Events template group.&nbsp; I&#8217;ve named mine &#8220;details&#8221;&#8212;you can choose a different template name, just remember to use your name in all the links pointing at the template.&nbsp; The ministries/details template is a good starting point for events/details, so either choose to copy it while creating the new template or copy/paste the code in once you&#8217;ve created a blank template.
</p>
<p>
<strong>Tweak the Title and Location Indicators</strong>
<br />
Go through the top part of the template code and change any references from &#8220;ministries&#8221; to &#8220;events&#8221;.&nbsp; You&#8217;ll find them in the static page title text, the weblog parameter for the dynamic part of the page title, the body_id tag, and the my_location variable in the main navigation embed.
</p>
<p>
<strong>Change the Content Area Code</strong>
<br />
As usual I&#8217;ll provide the complete template code in a text file at the bottom of this post.&nbsp; Here&#8217;s the content area code it will contain - take a scan through it then I&#8217;ll cover the highlights after:
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;!--</span><span style="color: #0000BB">BEGIN CONTENT SECTION</span><span style="color: #007700">--&gt;<br />&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"interiorBox"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h2</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Event Details</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">h2</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"content_page_right"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">&#123;</span><span style="color: #007700">!--</span><span style="color: #0000BB">This is the main weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries tag that will <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">return </span><span style="color: #0000BB">the text content </span><span style="color: #007700">for </span><span style="color: #0000BB">this event</span><span style="color: #007700">.&nbsp;&nbsp;&nbsp;--</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries weblog</span><span style="color: #007700">=</span><span style="color: #DD0000">"events" </span><span style="color: #0000BB">disable</span><span style="color: #007700">=</span><span style="color: #DD0000">"trackbacks|member_data|pagination" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">limit</span><span style="color: #007700">=</span><span style="color: #DD0000">"1" </span><span style="color: #0000BB">show_future_entries</span><span style="color: #007700">=</span><span style="color: #DD0000">"yes"</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"post"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;title&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;event_details&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;embed</span><span style="color: #007700">=</span><span style="color: #DD0000">"embeds/comments_form" </span><span style="color: #0000BB">the_weblog</span><span style="color: #007700">=</span><span style="color: #DD0000">"events"</span><span style="color: #0000BB">&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"content_page_left"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">&#123;</span><span style="color: #007700">!--</span><span style="color: #0000BB">Using a second weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries tag mostly to keep <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the template code more understandable</span><span style="color: #007700">.&nbsp;&nbsp;&nbsp;--</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries weblog</span><span style="color: #007700">=</span><span style="color: #DD0000">"events" </span><span style="color: #0000BB">disable</span><span style="color: #007700">=</span><span style="color: #DD0000">"trackbacks|member_data|pagination" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">limit</span><span style="color: #007700">=</span><span style="color: #DD0000">"1" </span><span style="color: #0000BB">show_future_entries</span><span style="color: #007700">=</span><span style="color: #DD0000">"yes"</span><span style="color: #0000BB">&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"event_details"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">When</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;entry_date format</span><span style="color: #007700">=</span><span style="color: #DD0000">"%F %d, %Y"</span><span style="color: #0000BB">&#125; </span><span style="color: #007700">&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;</span><span style="color: #0000BB">&#123;entry_date format</span><span style="color: #007700">=</span><span style="color: #DD0000">"%g:%i%A"</span><span style="color: #0000BB">&#125; </span><span style="color: #007700">&lt;</span><span style="color: #0000BB">br </span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for </span><span style="color: #0000BB">&#123;event_duration&#125; hours<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"event_details"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Where</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;event_location&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;if event_cost&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"event_details"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Cost</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">$&#123;event_cost&#125;.00 </span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">if&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"event_details"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Contact</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;event_contact_name&#125;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">br</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;event_contact_email&#125;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">br</span><span style="color: #007700">/&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;event_contact_phone&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;if event_sponsoring_ministry </span><span style="color: #007700">!=</span><span style="color: #DD0000">"0"</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"event_details"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Sponsoring Ministry</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;related_entries id</span><span style="color: #007700">=</span><span style="color: #DD0000">"event_sponsoring_ministry"</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;url_title_path=ministries/details&#125;"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;title&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">related_entries&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">if&#125;<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;</span>
</code></div><p>
</p>
<p>
<strong>Show Future Entries</strong>
<br />
Note the use of the &#8220;show_future_entries&#8221; in all weblog:entries tags.&nbsp; If you don&#8217;t specify this the page will come up blank when you try to bring up the details for an event that hasn&#8217;t happened yet.&nbsp; Note that the same change needs to happen in the weblog:entries tag that builds the page title.
</p>
<p>
<strong>Commenting</strong>
<br />
Adding the ability to comment on an event is easily done by adding :
<br />
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;embed</span><span style="color: #007700">=</span><span style="color: #DD0000">"embeds/comments_form" </span><span style="color: #0000BB">the_weblog</span><span style="color: #007700">=</span><span style="color: #DD0000">"events"</span><span style="color: #0000BB">&#125;</span>
</code></div><p>
</p>
<p>
This is when the time invested in setting up comments as embedded templates really pays off.
</p>
<p>
<strong>Handling Fields That May Be Empty</strong>
<br />
This code has two areas that look for fields having content before displaying them.&nbsp; The first one is for an event cost.&nbsp; Not all events will have a cost, and I don&#8217;t want the template to show a blank &#8220;Cost&#8221; area if there hasn&#8217;t been one entered.&nbsp; So the following code first checks for a value in the event_cost field and only displays the whole div if there is a cost:
<br />
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;if event_cost&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"event_details"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Cost</span><span style="color: #007700">:&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">$&#123;event_cost&#125;.00 </span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">if&#125;</span>
</code></div><p>
</p>
<p>
Note that I&#8217;ve used a shorthand approach to the if statement.&nbsp; I could also use:
<br />
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;if event_cost</span><span style="color: #007700">!=</span><span style="color: #DD0000">""</span><span style="color: #0000BB">&#125;</span>
</code></div><p>
</p>
<p>
Which is also saying &#8220;if event_cost is not equal to empty&#8221;.&nbsp; You can reference the documentation on <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/templates/globals/conditionals.html">conditionals</a> for other comparison operators.
</p>
<p>
The other area that checks for an empty field is for the event sponsoring ministry: 
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;if event_sponsoring_ministry </span><span style="color: #007700">!=</span><span style="color: #DD0000">"0"</span><span style="color: #0000BB">&#125;</span>
</code></div><p>
</p>
<p>
So why is this one different?&nbsp; Because event_sponsoring_ministry is a related entries field.&nbsp; It just works differently and rather than checking for an empty field you have to check for the 0 value instead.
</p>
<p>
<strong>Related Entries</strong>
<br />
OK - now I&#8217;m to the new and cool stuff in this series.&nbsp; The assumption I made when creating this calendar is that many of the events would be put on by specific ministries in the church.&nbsp; If that is indeed the case then I wanted to be able to link an event to a ministry and vice-versa.&nbsp; Rather than force a content administrator to manually create those links I&#8217;m using ExpressionEngine&#8217;s relationship ability to programmatically link them.&nbsp; By setting up a relationship field in the events fieldset, specifying the Ministries weblog as its source, and choosing a ministry for each event as it gets entered, now I can use the <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/related_entries.html">related_entries</a> tag to pull that value out and display it:
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"event_details"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Sponsoring Ministry</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">h3</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;related_entries id</span><span style="color: #007700">=</span><span style="color: #DD0000">"event_sponsoring_ministry"</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;url_title_path=ministries/details&#125;"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;title&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">p</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">related_entries&#125;<br /></span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;</span>
</code></div><p>
</p>
<p>
Note that this code is within a parent weblog:entries tag, and I&#8217;ve had to specify an id which is the name of the field holding the relationship.&nbsp; Within the related_entries tag I could pull any of the content from the related post in the Ministries weblog&#8212;but for my needs just wanted a linked title.
</p>
<p>
<strong>Explaining Relationships</strong>
<br />
There is also the <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/reverse_related_entries.html">reverse_related_entries</a> tag - so how do you know when to use which?
</p>
<p>
I always tend to visualize relationships as a pipe.&nbsp; At each end of the pipe is a post - in this case the post holding the Event content is at one end of the pipe.&nbsp; The post holding the Ministry event is at the other end of the pipe.&nbsp; The outside of the pipe has an arrow painted on it.&nbsp; The arrow points <i>from </i>the post where the relationship was created, and points <i>to</i> the post that was chosen in the drop-down field.
</p>
<p>
Now when I&#8217;m coding if I&#8217;m dealing with one of those two posts and want to look at the other one, I just look at the arrow on the pipe. If I&#8217;m looking through the pipe in the same direction as the arrow, my code needs the related_entries tag.&nbsp; If I&#8217;m looking against the arrow, I need reverse_related_entries.
</p>
<p>
The other way to think about it is parents and children.&nbsp; The post where the relationship is established is the parent post, and the post chosen in the relationship drop-down is the child.&nbsp; If you are working with a parent and need content from a child, then you use related_entries.&nbsp; If you are working with a child post and want information from the parent, it&#8217;s reverse_related_entries.
</p>
<p>
In the next chapter I&#8217;ll show the use of reverse_related_entries by editing ministries/detail to list each event the ministry has coming up.
</p>
<p>
<strong>Update events/index to Add Links</strong>
<br />
With the content of events/detail now in place, the only remaining thing is to edit events/index to point links at the new template.
<br />
This code
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"event_link"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"#" </span><span style="color: #0000BB">title</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;embed="</span><span style="color: #0000BB">embeds</span><span style="color: #007700">/</span><span style="color: #0000BB">event_rollover_title</span><span style="color: #DD0000">" my_entry_id="</span><span style="color: #0000BB">&#123;entry_id&#125;</span><span style="color: #DD0000">"&#125;"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;title&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;<br />&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;</span>
</code></div><p>
Just needs to change to:
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"event_link"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;url_title_path=events/details&#125;" </span><span style="color: #0000BB">title</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;embed="</span><span style="color: #0000BB">embeds</span><span style="color: #007700">/</span><span style="color: #0000BB">event_rollover_title</span><span style="color: #DD0000">" my_entry_id="</span><span style="color: #0000BB">&#123;entry_id&#125;</span><span style="color: #DD0000">"&#125;"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;title&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;<br />&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;</span>
</code></div><p>
</p>
<p>
<strong>Companion Files</strong>
<br />
The zip archive below includes:
</p>
<ul><li>New events/details</li>
<li>Updated events/index</li>
<li>Updated stylesheets/style</li></ul>
<p>
<a href="http://www.train-ee.com/church/companion_files/21-Events-Details.zip">21-Events-Details.zip</a>
</p>
<p>
Until next time - cheers!
</p>
		]]>
	</description>       

      <dc:subject>Building a Church Site</dc:subject>
      <dc:date>2008-07-26T14:26:17-05:00</dc:date>
    </item>

    <item>
      <title>20 &#45; Implementing the Event Calendar Index Template</title>
      <link>http://www.train-ee.com/courseware/free_tutorials/comments/20-implementing-the-event-calendar-index-template/</link>
      <guid>http://www.train-ee.com/courseware/free_tutorials/comments/20-implementing-the-event-calendar-index-template/#When:21:20:41Z</guid>
	<description>
		<![CDATA[
			<p>With the <a href="http://www.expressionengine.com/index.php?affiliate=boyink">ExpressionEngine</a> calendar functionality explained, let&#8217;s dive into the code.&nbsp; In this chapter I&#8217;ll cover the implementation of the Event Calendar index template.&nbsp; From a coding perspective I&#8217;ll show how to do the basic implementation, and then use an embedded template with embedded variable to get around the &#8220;no custom field&#8221; limitation of the weblog:calendar tag.&nbsp; This chapter will also lay some groundwork for using EE&#8217;s <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/related_entries.html">relationships</a> to tie events to ministries.
</p> <p><strong>Preview the Results</strong>
<br />
Before getting your hands dirty with the code, take a look at the <a href="http://church.train-ee.com/index.php/events/">completed calendar index</a> on the sample site.&nbsp; I want you to make sure it&#8217;s what you&#8217;re after before proceeding.&nbsp; You can see that EE generates the calendar view, and if you look at either July or August of 2008 there are entries that show up that display a linked title.&nbsp; At the moment the link doesn&#8217;t go anywhere - that requires a detail template that I&#8217;ll cover in the next chapter.
</p>
<p>
If you mouse over a link, you should get the browser title pop-up that displays a bit more information about the event&#8212;the start time, the duration and the location.
</p>
<p>
That&#8217;s roughly half the calendar functionality I&#8217;ll be covering in this series.&nbsp; The other half will be the detail template (that the title will link to) and implementing an events RSS feed.
</p>
<p>
If that works for you, keep reading&#8230;
</p>
<p>
<strong>Overall Implementation Steps</strong>
</p>
<ul><li>Create events weblog</li>
<li>Create events custom field group</li>
<li>Add fields to the group</li>
<li>Enter content</li>
<li>Create events template group</li>
<li>Update embeds/main_nav</li>
<li>Update stylesheet/styles</li>
<li>Add code to events/index</li>
<li>Create embeds/event_rollover_title</li></ul>
<p>
<strong>Create an Events Weblog</strong>
<br />
Event calenders in ExpressionEngine are powered by a standard weblog - so I&#8217;ve created a new weblog and named it &#8220;Events&#8221;, with a short name of &#8220;events&#8221;.&nbsp; 
</p>
<p>
<strong>Create an Events Custom Field Group</strong>
<br />
Events have their own unique data structure, so a new field group is required. Create an &#8220;Events&#8221; custom field group.
</p>
<p>
Add the following fields to the group.&nbsp; I&#8217;ve listed the field name, label, type, size and formatting options for the fields I&#8217;ve added:
</p>
<ul><li>event_duration, Event Duration, Text Input, 3, None</li>
<li>event_location, Event Locations, Drop-down List, manually populated, None</li>
<li>event_cost, Event Cost, text input, 4, none</li>
<li>event_contact_name, Event Contact Name, text input, 128, none</li>
<li>event_contact_phone, Event Contact Phone, text input 128, none</li>
<li>event_contact_email, Event Contact Email, text input, 128, none</li>
<li>event_details, Event Details, text area, 6 rows, XHTML</li></ul>
<p>
<strong>And One More</strong>
<br />
While planning this section initially I was going to tie together events and ministries using categories.&nbsp; I&#8217;m going to do a bit of a direction change and use <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/related_entries.html">relationships</a> instead.&nbsp; Using categories only nets me being able to show related events on Ministry category pages&#8212;so if you view the <a href="http://church.train-ee.com/index.php/ministries/category/for-singles/">Ministries for Singles</a> I&#8217;d be able to pull the upcoming events for singles - but I see a couple of issues with that approach.&nbsp; The design of the Ministries index template doesn&#8217;t allow for another content type to display and I don&#8217;t want to go down the path of a category-specific template.&nbsp; Using categories also doesn&#8217;t easily allow me to pull ministry-specific events to a ministry detail page&#8212;and I think that&#8217;s a more helpful connection than the category level tie-in.
</p>
<p>
Relationships will let me create a direct connection between an event and a ministry.&nbsp; I&#8217;ll be able to use that connection to link from a ministry detail page to an event, and from an event detail page to the sponsoring ministry.
</p>
<p>
So I&#8217;ve added one more field to my Events field group - a relationship field:
</p>
<p>
Name:
<br />
event_sponsoring_ministry
</p>
<p>
Label:
<br />
Event Sponsoring Ministry
</p>
<p>
Field Type:
<br />
Relationship
</p>
<p>
Weblog to Create Relationship With:
<br />
Ministries
</p>
<p>
Display Criteria:
<br />
I choose &#8220;Sort by Title&#8221; in &#8220;Ascending&#8221; order
</p>
<p>
In this chapter all we&#8217;ll do is setup the field and assign a related Ministry while entering content.&nbsp; In the next chapter I&#8217;ll show how to pull related Ministry information to the Events detail view.
</p>
<p>
<strong>Connect the Field Group to the Weblog</strong>
<br />
Make sure to assign the new field group to the Events weblog via the &#8220;Edit Groups&#8221; link in Weblog Management.
</p>
<p>
<strong>Enter Content</strong>
<br />
Go ahead and post some new entries in the Events weblog. There are a couple of new things to note here:
</p>
<p>
Make sure to click the Date tab and assign choose an Entry Date that&#8217;s in the future.&nbsp; The time of the post will be used as the event starting time so round it off to a nice &#8220;top of the hour&#8221; number.&nbsp; The other new thing is to now use the relationship field - so for every post choose a sponsoring ministry in the drop-down.&nbsp; I found that putting a number of events on one date helped me with formatting the calendar visually.&nbsp; Keep in mind that you can edit your entries to assign new entry dates to move events around the calendar for formatting purposes.
</p>
<p>
<strong>Create an Events Template Group</strong>
<br />
With the content structures in place I&#8217;ll now work on pulling the content to the site.&nbsp; Create a new template group named &#8220;events&#8221;.&nbsp; Since the content is full-width like the Beliefs page, it made a good starting point - so I copied that code into the new events/index template.
</p>
<p>
<strong>Coding the Template</strong>
<br />
The first order of business is to change all references of &#8220;beliefs&#8221; to &#8220;events&#8221; - so the page title, the body id, and the variable in the main navigation embed.&nbsp; Then in the main content div you can remove all the code there entirely.
</p>
<p>
I used the <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=/docs/modules/weblog/calendar.html">calendar code from the EE documentation</a> as a starting point for my code - the &#8220;big&#8221; version which is the second example on that page.&nbsp; I also used the provided <a href="http://expressionengine.com/docs/modules/weblog/calendar_css.txt">calendar css</a> as a starting point.
</p>
<p>
After some tweaks - here is the guts of my events/index template - take a scan through it and then I&#8217;ll highlight the changes I had to make from the example code I used as a starting point:
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;!--</span><span style="color: #0000BB">BEGIN CONTENT SECTION</span><span style="color: #007700">--&gt;<br />&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"interiorBox"</span><span style="color: #007700">&gt;<br /><br /></span><span style="color: #0000BB">&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">calendar </span><span style="color: #007700">switch=</span><span style="color: #DD0000">"calendarToday|calendarCell" </span><span style="color: #0000BB">weblog</span><span style="color: #007700">=</span><span style="color: #DD0000">"events" </span><span style="color: #0000BB">show_future_entries</span><span style="color: #007700">=</span><span style="color: #DD0000">"yes" </span><span style="color: #0000BB">sort</span><span style="color: #007700">=</span><span style="color: #DD0000">"asc"</span><span style="color: #0000BB">&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">table id</span><span style="color: #007700">=</span><span style="color: #DD0000">"event_calendar" </span><span style="color: #0000BB">summary</span><span style="color: #007700">=</span><span style="color: #DD0000">"Church Event Calendar" </span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">tr </span><span style="color: #007700">class=</span><span style="color: #DD0000">"calendarHeader"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">th</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"calendarMonthLinks"</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;previous_path=events&#125;"</span><span style="color: #007700">&gt;&lt;&lt;&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">th</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">th colspan</span><span style="color: #007700">=</span><span style="color: #DD0000">"5"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;date format</span><span style="color: #007700">=</span><span style="color: #DD0000">"%F %Y"</span><span style="color: #0000BB">&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">th</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">th</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"calendarMonthLinks"</span><span style="color: #007700">&gt;&lt;</span><span style="color: #0000BB">a </span><span style="color: #007700">class=</span><span style="color: #DD0000">"calendarMonthLinks" </span><span style="color: #0000BB">href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;next_path=events&#125;"</span><span style="color: #007700">&gt;&gt;&gt;&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;&lt;/</span><span style="color: #0000BB">th</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">tr</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">tr</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;calendar_heading&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">td </span><span style="color: #007700">class=</span><span style="color: #DD0000">"calendarDayHeading"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;lang</span><span style="color: #007700">:</span><span style="color: #0000BB">weekday_abrev&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">td</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">calendar_heading&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">tr</span><span style="color: #007700">&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;calendar_rows &#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;row_start&#125;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">tr</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">row_start&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;if entries&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">td </span><span style="color: #007700">class=</span><span style="color: #DD0000">'&#123;switch&#125;' </span><span style="color: #0000BB">align</span><span style="color: #007700">=</span><span style="color: #DD0000">'center'</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;day_number&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;entries&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"event_link"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"#" </span><span style="color: #0000BB">title</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;embed="</span><span style="color: #0000BB">embeds</span><span style="color: #007700">/</span><span style="color: #0000BB">event_rollover_title</span><span style="color: #DD0000">" my_entry_id="</span><span style="color: #0000BB">&#123;entry_id&#125;</span><span style="color: #DD0000">"&#125;"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;title&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">entries&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">td</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">if&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;if not_entries&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">td </span><span style="color: #007700">class=</span><span style="color: #DD0000">'&#123;switch&#125;' </span><span style="color: #0000BB">align</span><span style="color: #007700">=</span><span style="color: #DD0000">'center'</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;day_number&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">td</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">if&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;if blank&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">td </span><span style="color: #007700">class=</span><span style="color: #DD0000">'calendarBlank'</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;day_number&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">td</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">if&#125;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;row_end&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">tr</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">row_end&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">calendar_rows&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">table</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">calendar&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;&lt;!--</span><span style="color: #0000BB">END CONTENT SECTION</span><span style="color: #007700">--&gt;</span>
</code></div><p>
</p>
<p>
Here are the changes I had to make from the sample code I copied from the EE docs:
</p>
<ul><li>Changed the weblog it references - to &#8220;events&#8221; in my case</li>
<li>Changed the next_path and previous_path values - and just referenced this index template</li>
<li>Added <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/calendar.html#par_show_future_entries">&#8220;show_future_entries="yes&#8221;</a> to the calendar tag - otherwise the calendar will only show events for today or ones that had passed</li></ul>
<p>
With those changes I had a working basic event calendar.
</p>
<p>
<strong>Getting Tricky with Embeds</strong>
<br />
I wanted to take it a step further though and see what it would require in order to be able to pull custom fields to the calendar view - so users could get more event information without having to click through to the detail page.
</p>
<p>
Remember that the weblog:calendar tag doesn&#8217;t support custom fields by default.&nbsp; However - it does return entry_id.&nbsp; Using that as a bridge I was able to pull custom field content to the index template by using an <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/templates/embedding_templates.html">embedded template with an embedded variable</a>.&nbsp; I decided that directly displaying more content on the calendar would visually junk it up so decided to pull custom field content into the link title attribute .&nbsp; The result? Mousing over an event link will pop up the little browser tooltip and display the event start time, duration and location.
</p>
<p>
So I created a new template in my embeds group called &#8220;event_rollover_title&#8221;.&nbsp; It has the following code:
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries weblog</span><span style="color: #007700">=</span><span style="color: #DD0000">"events" </span><span style="color: #0000BB">entry_id</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;embed:my_entry_id&#125;" </span><span style="color: #0000BB">show_future_entries</span><span style="color: #007700">=</span><span style="color: #DD0000">"yes" </span><span style="color: #0000BB">dynamic</span><span style="color: #007700">=</span><span style="color: #DD0000">"off"<br /></span><span style="color: #0000BB">disable</span><span style="color: #007700">=</span><span style="color: #DD0000">"trackbacks|pagination|member_data|categories"</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;Starts</span><span style="color: #007700">:&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;</span><span style="color: #0000BB">&#123;entry_date format</span><span style="color: #007700">=</span><span style="color: #DD0000">"%g:%i%A"</span><span style="color: #0000BB">&#125;</span><span style="color: #007700">&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Duration</span><span style="color: #007700">:&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;</span><span style="color: #0000BB">&#123;event_duration&#125;</span><span style="color: #007700">&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;</span><span style="color: #0000BB">hrs</span><span style="color: #007700">.&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Location</span><span style="color: #007700">:&amp;</span><span style="color: #0000BB">nbsp</span><span style="color: #007700">;</span><span style="color: #0000BB">&#123;event_location&#125;<br />&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">weblog</span><span style="color: #007700">:</span><span style="color: #0000BB">entries&#125;</span>
</code></div><p>
</p>
<p>
and then added a calling template in events/index:
<br />
</p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"#" </span><span style="color: #0000BB">title</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;embed="</span><span style="color: #0000BB">embeds</span><span style="color: #007700">/</span><span style="color: #0000BB">event_rollover_title</span><span style="color: #DD0000">" my_entry_id="</span><span style="color: #0000BB">&#123;entry_id&#125;</span><span style="color: #DD0000">"&#125;"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&#123;title&#125;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;</span>
</code></div><p>
</p>
<p>
Here&#8217;s how it works:
<br />
The parent weblog:calendar tag returns entry_id, which gets passed to this embedded template.&nbsp; This embedded template takes the entry_id and uses it as a parameter on a weblog:entries tag, which as you know returns all custom fields.&nbsp; The fields within the weblog:entries pull out the post time (used here as an event start time), duration, and location.&nbsp; This text is assembled and returned to the calling template as the link title text.
</p>
<p>
One note I need to make about this approach is that it, due to it&#8217;s nested approach, it could be resource intensive if you have a lot of calendar entries.&nbsp; For the couple of church sites I&#8217;ve been involved with, I wouldn&#8217;t be worried, as there are rarely more than a couple of entries a day.&nbsp; I&#8217;ll also - in a future chapter - cover some caching approaches that will also help mitigate any performance concerns.
</p>
<p>
<strong>Don&#8217;t Forget</strong>
<br />
Don&#8217;t forget to update embeds/main_nav to make the link to events/index live.
</p>
<p>
<strong>Companion Files</strong>
<br />
The companion file zip archive for this chapter includes
</p>
<ul>
<li>New events/index</li>
<li>Updated stylesheets/style</li>
<li>Updated embeds/main_nav</li>
<li>New embeds/event_rollover_title</li>
</ul>
<p>
Here&#8217;s a link to download the companion files: <a href="http://www.train-ee.com/church/companion_files/20-Events-Index.zip">20-Events-Index.zip</a>
</p>
<p>
Next up - the events detail template.
</p>
		]]>
	</description>       

      <dc:subject>Building a Church Site</dc:subject>
      <dc:date>2008-07-19T21:20:41-05:00</dc:date>
    </item>

    <item>
      <title>19 &#45; Events Calendar Overview</title>
      <link>http://www.train-ee.com/courseware/free_tutorials/comments/19-events-calendar-overview/</link>
      <guid>http://www.train-ee.com/courseware/free_tutorials/comments/19-events-calendar-overview/#When:20:06:30Z</guid>
	<description>
		<![CDATA[
			<p>Most active churches will have, at any given time, a number of special events going on that need to be communicated to members and potential visitors alike.&nbsp; From a facilities perspective often there are large meeting spaces that need to have an availability calendar so members planning an event know when a particular space is available.&nbsp; <a href="http://www.expressionengine.com/index.php?affiliate=boyink">ExpressionEngine</a> has some built-in calendaring capabilities that can, at times, meet these requirements.&nbsp; In this chapter I&#8217;ll provide an overview of the EE calendaring capabilities, talk about it&#8217;s strengths and weaknesses, and cover some options to the EE calendar.
</p> <p><strong>ExpressionEngine Calendar Overview</strong>
<br />
I know a number of you have been waiting for me to get to this part of the site build&#8212;and it has me a bit worried as I&#8217;m afraid the expectation is that I&#8217;ll show how to build this really great full-featured event calendar that slices and dices event information like something from <a href="http://www.ronco.com/index.aspx">Ronco</a>.
</p>
<p>
The EE calendar just isn&#8217;t that complex, however, so I want to do a bit of work to manage your expectations before plowing into the code.&nbsp; Let me lead off with an overview of the EE&#8217;s <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/calendar.html">calendar function</a> - a description I wrote in the comments on an earlier chapter in this series:
<br />
<blockquote><p>
First - imagine a weblog. Now add an entry on the weblog.&nbsp; It goes in with a publish date.&nbsp; Many blogs have those little sidebar calendars that show you when posts were made - so if you posted an entry on the 6th of March that date would then become clickable.&nbsp; Clicking on it would filter your current view down to just the entries posted on that date.
</p>
<p>
Got it?&nbsp; Now - blow up that small calendar to be full-page, post some entries with future dates, and tell EE to show entries with future dates.&nbsp; Throw the title of the post on the full-page calendar view. Link the title to another template that can show more details for one event.
</p>
<p>
That&#8217;s the essential EE calendar capability.&nbsp; It&#8217;s basic weblog post information, plotted on a calendar view,  with the ability to show entries with future dates, and link to another template that can show all the content for that one event.</p></blockquote>
<p>
<strong>Advantages</strong>
<br />
There are a number of advantages to using EE for an event calendar.&nbsp; First - you can offer content administrators a consistent publish and edit process and interface.&nbsp; Entering an event is the same as a new ministry.&nbsp; 
</p>
<p>
Second - you can take advantage of categories or relationships to group event content together with other content.&nbsp; I plan on doing that here, using relationships to tie an event to a ministry so that I can show specific upcoming events on a ministry page. 
</p>
<p>
Third - you if go down the path of memberships on your site you can allow any registered member to submit a calendar event using a <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/entry_form.html">Stand-Alone Entry Form</a>.&nbsp; Those entries can then take advantage of <a href="http://www.expressionengine.com/docs/cp/admin/weblog_administration/custom_entry_statuses.html">Custom Entry Status</a> so that the new submission goes to &#8220;pending&#8221; status and doesn&#8217;t appear on the site.&nbsp; You can then implement an <a href="http://www.expressionengine.com/docs/cp/admin/weblog_administration/weblog_edit_preferences.html">Entry Notification</a> such that a calendar administrator would get an email when a new event is submitted.&nbsp; The calendar administrator would then review the event and if approved set the status to &#8220;Open&#8221; which would cause it to display on the site.
</p>
<p>
<strong>Disadvantages</strong>
<br />
The native EE calendar doesn&#8217;t do recurring or multi-day events - but there is <a href="http://lincolnite.com/ee/repeet/">a third-party plugin</a> that adds that capability - so you post an entry, some details about how it repeats, and then your event shows on the full-page calendar view multiple times.
</p>
<p>
The native <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=docs/modules/weblog/calendar.html">weblog:calendar</a> tag doesn&#8217;t support custom fields, which means that on the full-page calendar view you are limited to what can display for each event.&nbsp; Options are title, author, and entry_id. There are ways around this restriction that aren&#8217;t too hard, so I&#8217;ll cover one here.
</p>
<p>
EE&#8217;s calendar also doesn&#8217;t, inherently, work with categories. In other words, you can&#8217;t assign categories to the weblog driving your event calendar and then use native EE tags to link to a categorized view of the overall calendar.&nbsp; You can get to this functionality with a <a href="http://expressionengine.com/forums/viewthread/61910/">bit of php trickery</a>, but for this series I&#8217;ve decided to stay within the bounds of native EE functionality only.
</p>
<p>
There is no native iCal support - although there seems to be some <a href="http://expressionengine.com/forums/viewthread/33619/P18/#415850">movement in the forums around it</a>.
</p>
<p>
<strong>Options</strong>
<br />
If native EE doesn&#8217;t meet your calendaring requirements the next option I&#8217;d suggest looking at is using a Google Calendar.&nbsp; There is a relatively new <a href="http://expressionengine.com/forums/viewthread/79178/">Google Calendar Plugin</a> for pulling information from a public calendar to EE.&nbsp; However it doesn&#8217;t have much activity around it and I haven&#8217;t tested it&#8212;so don&#8217;t consider this link an endorsement.
</p>
<p>
<strong>Having Said All That</strong>
<br />
My plan here is to show the implementation of a simple event calendar using native EE tags.&nbsp; I&#8217;ll push the bounds a bit, showing how to use entry_id as a bridge to pull custom fields to the full-page calendar view.&nbsp; Other than that, this will be a very straightforward implementation.
</p>
<p>
<strong>In the Real World</strong>
<br />
My church uses the <a href="http://www.mannais.org/index.php/event_calendar/">EE calendar</a> but I have extended EE&#8217;s native functionality with the repEEt plugin linked to above.&nbsp; I also implemented a Stand Alone Entry Form with workflow to allow calendar submissions by any registered member.&nbsp; In all honesty if 10% of the events on the calendar were submitted that way it&#8217;d be great - in reality my wife and I &#8220;own&#8221; the web calendar and keep it updated based on what we hear going on while at church.
</p>
<p>
But - we&#8217;re a very small church with a small building.&nbsp; We don&#8217;t have a ton of staff, committees, or different facilities to manage.&nbsp; For us the combination of ExpressionEngine and repEET work well.
</p>
		]]>
	</description>       

      <dc:subject>Building a Church Site</dc:subject>
      <dc:date>2008-07-19T20:06:30-05:00</dc:date>
    </item>

    <item>
      <title>Integrating Monoslideshow with ExpressionEngine</title>
      <link>http://www.train-ee.com/courseware/free_tutorials/comments/integrating-monoslideshow-with-expressionengine/</link>
      <guid>http://www.train-ee.com/courseware/free_tutorials/comments/integrating-monoslideshow-with-expressionengine/#When:16:30:51Z</guid>
	<description>
		<![CDATA[
			<p><a href="http://www.5pieces.com/blog/monoslideshow-and-ee-gallery/">5Pieces.com</a> has an extensive tutorial on how to use Monoslideshow with the <a href="http://www.expressionengine.com/index.php?affiliate=boyink">ExpressionEngine</a> photo gallery module but I&#8217;ve had a few cases where using it with a custom weblog/custom fieldset was simpler for clients.
</p> <p>I won&#8217;t duplicate the help found at 5Pieces, or in the Monoslideshow documentation.&nbsp; All that&#8217;s really different is the code needed to pull the image and thumbnail specifications in the XML file used by Monoslideshow.
</p>
<p>
You&#8217;ll also need the &#8220;Extract URL Plus&#8221; plugin offered in <a href="http://www.expressionengine.com/index.php?affiliate=boyink&amp;page=/forums/viewthread/37056/">this EE forum thread</a>.
</p>
<p>
Note that in my case I have two fields in the photoblog: thumbnail and full_size_image.&nbsp; I don&#8217;t use captions so just plug the title in as the image title and description.&nbsp; I have MSS configured to not show this data anyway as I prefer to just let the images speak for themselves.
</p>
<p>
In order to get the XML to output correctly for Monoslideshow to parse it, I had to wrap a weblog:entries tag inside of a category:archive tag.&nbsp; There&#8217;s probably a more efficient way to do this with a custom query, but so far the performance seems acceptable.
</p>
<p>
Here&#8217;s the EE code required - keep in mind that there is more to the XML file that Monoslideshow requires.&nbsp; This code goes in the file after the &#8220;preferences&#8221; portion of the file closes.
<br />
<a href="http://www.train-ee.com/images/weblog/monoslideshow_xml.txt">monoslideshow_xml.txt</a>
</p>
<p>
Oh - this approach also assumes that all photoblog images are in the same directory.
<br />

</p>
		]]>
	</description>       

      <dc:subject>Extended Media</dc:subject>
      <dc:date>2008-07-18T16:30:51-05:00</dc:date>
    </item>

    <item>
      <title>Use Variables in Control Panel Settings</title>
      <link>http://www.train-ee.com/courseware/free_tutorials/comments/use-variables-in-control-panel-settings/</link>
      <guid>http://www.train-ee.com/courseware/free_tutorials/comments/use-variables-in-control-panel-settings/#When:16:11:34Z</guid>
	<description>
		<![CDATA[
			<p>Make the site launch process easier by using either the site_url or homepage variables in configuring Control Panel paths.
</p> <p>I think the site_url and homepage variables are a couple of my favorites in <a href="http://www.expressionengine.com/index.php?affiliate=boyink">ExpressionEngine</a>. I&#8217;ve found that you can actually use these in the EE Control Panel - wherever paths need to be specified.&nbsp; This includes: 
<br />
<ul>
<li>Weblog Path Settings</li>
<li>File Upload Preferences</li>
<li>Category Image URLs</li>
</ul>
<p>
Why would you want to use variables in these spots?
</p>
<p>
What happens to me quite often is - no matter how hard to I try to remember - I forget to change these paths after a site goes live.&nbsp; Then when, for example, someone uses the Search, the path of the link returned still has the &#8220;temporary&#8221; domain name in it.&nbsp; The link will still work, but it messes up your server logs and just doesn&#8217;t look as nice as getting the live URL in there.&nbsp; Or - I decide to rename &#8220;index.php&#8221; to something more semantic and then have to go find all the places where &#8220;index.php&#8221; is stored.
</p>
<p>
So - what I discovered I could do is use the variables in those settings - and then they will inherit the change to the homepage and root URL setting automatically.
</p>
<p>
So, for example, rather than having a Search Results URL setting of :
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #0000BB">http</span><span style="color: #007700">:</span><span style="color: #FF8000">//some.domain.here/index.php/template_group/template/</span>
</code></div><p>
</p>
<p>
I can specify:
<br />
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;homepage&#125;</span><span style="color: #007700">/</span><span style="color: #0000BB">template_group</span><span style="color: #007700">/</span><span style="color: #0000BB">template</span><span style="color: #FF8000">/</span>
</code></div><p>
</p>
<p>
Now when I change the &#8220;URL to the root directory of your site&#8221; and the &#8220;Name of your site&#8217;s index page&#8221; under Admin  >  System Preferences  >  General Configuration all those individual weblog paths will change as well.
</p>
<p>
With some paths -like category images - you won&#8217;t want the &#8220;index.php&#8221; in there since you are referring to an image and not a template.&nbsp; In that case you can use site_url instead:
</p>
<p>
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;site_url&#125;images</span><span style="color: #007700">/</span><span style="color: #0000BB">uploads</span><span style="color: #007700">/</span><span style="color: #0000BB">category_accessories_150</span><span style="color: #007700">.</span><span style="color: #0000BB">jpg</span>
</code></div><p>
</p>
<p>
Variables in Control Panel path settings == one less thing to worry about when launching a site == well worth it.
</p>
		]]>
	</description>       

      <dc:subject>Control Panel</dc:subject>
      <dc:date>2008-07-18T16:11:34-05:00</dc:date>
    </item>

    <item>
      <title>Member Photo Gallery in ExpressionEngine</title>
      <link>http://www.train-ee.com/courseware/free_tutorials/comments/member-photo-gallery-in-expressionengine/</link>
      <guid>http://www.train-ee.com/courseware/free_tutorials/comments/member-photo-gallery-in-expressionengine/#When:14:33:49Z</guid>
	<description>
		<![CDATA[
			<p>Here&#8217;s a a quick <a href="http://www.expressionengine.com/index.php?affiliate=boyink">ExpressionEngine</a> howto on creating a page showing all the photos members have uploaded to their profiles.
</p> <p>Situation:
<br />
My church - <a href="http://www.mannais.org">Manna</a> - wanted to have an &#8220;online directory&#8221; of member photos on the website.
</p>
<p>
One way to do this is to just use the Photo Gallery module and create a &#8220;members&#8221; category, upload some pics and title them with the member name.&nbsp; While this would give you a nice online directory, what it doesn&#8217;t do is integrate with the existing profiles which get linked to blog posts and comments, etc.
</p>
<p>
However,  the built in profiles don&#8217;t let you browse pictures - you can only navigate via the memberlist and click each name to view the full profile.&nbsp; The profile may or may not include a photo.
</p>
<p>
For the situation where you met someone but can&#8217;t remember their name this isn&#8217;t a great arrangement.
</p>
<p>
What you really want is the best of both options - photos stored in the profiles where members can upload and maintain them on their own, where they get linked to blog posts and comments, but also have a &#8220;gallery&#8221; page where you can browse photos to find a name.
</p>
<p>
That&#8217;s where this little howto comes in.&nbsp; Using the <a href="http://eedocs.pmachine.com/modules/query/index.html">Query Module</a> we can pull this data together in pretty short order.&nbsp; Here&#8217;s the code I used (note that I&#8217;ve removed all formatting and specific paths, so you&#8217;ll need to edit those to work on your site):
<br />
</p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;exp</span><span style="color: #007700">:</span><span style="color: #0000BB">query limit</span><span style="color: #007700">=</span><span style="color: #DD0000">"5" </span><span style="color: #0000BB">sql</span><span style="color: #007700">=</span><span style="color: #DD0000">"SELECT screen_name, bio,photo_filename, photo_width, photo_height<br />FROM exp_members <br />WHERE photo_filename &lt;&gt;'' ORDER BY screen_name "</span><span style="color: #0000BB">&#125;<br /><br /></span><span style="color: #007700">&lt;</span><span style="color: #0000BB">img src</span><span style="color: #007700">=</span><span style="color: #DD0000">"yourpathhere/&#123;photo_filename&#125;" </span><span style="color: #0000BB">height</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;photo_height&#125;" </span><span style="color: #0000BB">width</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;photo_width&#125;" </span><span style="color: #007700">/&gt;<br /></span><span style="color: #0000BB">&#123;screen_name&#125;<br />&#123;bio&#125;<br /></span><span style="color: #007700">&lt;</span><span style="color: #0000BB">a href</span><span style="color: #007700">=</span><span style="color: #DD0000">"your_path_here/index.php/member/&#123;member_id&#125;/"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">Full Profile </span><span style="color: #007700">&gt;&gt;&lt;/</span><span style="color: #0000BB">a</span><span style="color: #007700">&gt;<br /><br /></span><span style="color: #0000BB">&#123;paginate&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">div </span><span style="color: #007700">class=</span><span style="color: #DD0000">"paginate"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">span </span><span style="color: #007700">class=</span><span style="color: #DD0000">"pagecount"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Page &#123;current_page&#125; of &#123;total_pages&#125; pages<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">span</span><span style="color: #007700">&gt;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;pagination_links&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">div</span><span style="color: #007700">&gt;<br /></span><span style="color: #0000BB">&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">paginate&#125;<br /><br />&#123;</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">query&#125;</span>
</code></div><p>
</p>
<p>
This code:<ul><li>Only loads those members who have images</li><li>Sorts the results by screen name</li><li>Loads 4 images to a page</li><li>Adds pagination links if there are more than 4</li><li>Loads the member name and bio</li><li>Links to the standard EE profile for each member</li></ul>
<p>
Voila!
</p>
<p>
Here&#8217;s the &#8220;straight-talk&#8221; around what happened with my church and this page. This approach was my response to being asked to put together an online directory on the site - with the expectation that I would bring my camera, take pictures of people, and post them to the site.&nbsp;  I&#8217;ve consistently avoided putting myself in such roles as I don&#8217;t want to be the &#8220;website update boy&#8221; for the church.&nbsp; I&#8217;d much rather spend my time putting together ways to enable self-service for church members at large - so rather than taking on the creation and maintenance of a member photo gallery this approach put the responsibility for uploading photos in the hands of each member.
</p>
<p>
However in the end this member photo directory was one of those times when the technology was the easy part, but getting people to take action was the harder part.&nbsp; Not enough people uploaded their own picture to make this page worthwhile - so it only lasted a few months on the site.
</p>
<p>
What this tells me is that that a photo directory just wasn&#8217;t that important to enough people - otherwise they would have taken the 10 minutes to upload a photo.&nbsp; 
</p>
		]]>
	</description>       

      <dc:subject>Member Content</dc:subject>
      <dc:date>2008-07-18T14:33:49-05:00</dc:date>
    </item>

    
    </channel>
</rss>