NP_EventBlog.php

Turn a blog into an event calendar (in conjunction with NP_EventCalendar 1.0 or greater, included in download). Show a calendar with past and future events, display a few upcoming events on your main page, or in a sidebar. Requires Nucleus CMS 3.60 or higher.

General Plugin info
Author: gRegor, ftruscot
Current Version: 2.00.01
Download: download
Code: na
Demo: demo
Forum Thread: http://forum.nucleuscms.org/viewtopic.php?t=9035&highlight=

Installing

  1. Unzip the file and upload the contents to your plugin directory
  2. Install the plugins (NP_EventBlog and NP_EventCalendar…
  3. Set plugin options and configure as described below

How to use the plugin

You probably already have a main blog set up for your group, organization, etc… To use this plugin, you should create a New Weblog following the “Advanced” method described in the instructions on the New Weblog form (click “New Weblog” in the left navigation bar of the admin area).

Once the blog is created, edit its settings (from the Admin Home page in the admin area) and set the “Enable Event Blog plugin” field to “yes” and then save the setttings. This will allow this blog to show future items and work with the EventBlog plugin. Your main blog should leave this field set to “no”.

Now you have a blog ready to be used to display events and the real work begins. In the following example, we have a comedy troup with weekly engagements. We want the next upcoming event to be listed in a sidebar of the main site with a link to a page with the full calendar view of all past and future events. We have given this new weblog the shortname of “events”. We are using the default skin, but this can be done with any skin.

1. Add some event items into the events blog. Be sure to complete the Extra Plugin fields for the Event Blog plugin (event date, venue, times, etc…).

2. Add the “Upcoming Events” block to the sidebar. In the skins/default/sidebar.inc file, insert the following block of code where you want the list of upcoming items displayed:

<div class="sidebar">
<div class="nextevent">
<h3>Next Show</h3>
<%EventBlog(future[list],1,events,default/eventlist)%>
</div>
</div>

3. Create a new template called default/eventlist to format listed events in sidebar.inc. The easiest way to do this would be to clone the default/index skin and to rename it default/eventlist. Then edit the default/eventlist template and replace the Item Body field with the following:

<h4><a href="<%itemlink%>" title="<%title(attribute)%>"><%title%></a></h4>
Date: <%date%><br />
Time: <%EventBlog(var,starttime)%> to Time: <%EventBlog(var,endtime)%> <br /> 
Venue: <%EventBlog(var,venue)%> <br />
Address: <%EventBlog(var,street)%> <%EventBlog(var,city)%>, <%EventBlog(var,state)%> <%EventBlog(var,zip)%>
<p>Tickets are $<%EventBlog(var,cost)%> at the door. <%EventBlog(var,ages)%> ages welcome.</p>
<%body%>
<%morelink%>

4. Add another template for showing the events on the item pages skin part. Clone default/item and rename the clone to default/event. Modify the Item Body field of the default/event template to look like this:

<div class="contenttitle">
<h2><%date%>: <%title(raw)%></h2>
</div>
<div class="contentbody">
Date: <%date%><br />
Time: <%EventBlog(var,starttime)%> to Time: <%EventBlog(var,endtime)%> <br /> 
Venue: <%EventBlog(var,venue)%> <br />
Address: <%EventBlog(var,street)%> <%EventBlog(var,city)%>, <%EventBlog(var,state)%> <%EventBlog(var,zip)%>
<p>Tickets are $<%EventBlog(var,cost)%> at the door. <%EventBlog(var,ages)%> ages welcome.</p>
<%body%><br /><br />
<a name="more"></a><%more%>
</div>

5. Adjust the template/html/css as needed to make it fit your site, but you should now see the next event in the sidebar.

6. Modify the Main Index skin part of the default skin to handle the events blog and the main blog differently. Remember, we want the Upcoming Shows page (index of events blog) to show a calendar and the next so many shows. In the admin area, find the Main INdex part of the default skin and replace <%blog(default/index,10)%> with the following:

<%if(blogsetting,bshortname,events)%>
<hr />
<%EventBlog(calendar,events)%>
<hr />
<%EventBlog(future,10,events,default/eventlist)%>
<%else%>
<%blog(default/index,10)%>
<%endif%>

7. Modify the Item Pages skin part. Replace <%item(default/item)%> with this:

<%if(blogsetting,bshortname,events)%>
<%EventBlog(all,1,events,default/event)%>
<%else%>
<%item(default/item)%>
<%endif%>

8. Modify the Archives skin part. Replace <%archive(default/index)%> with this:

<%if(blogsetting,bshortname,events)%>
<hr />
<%EventBlog(calendar,events)%>
<hr />
<%EventBlog(all,100,events,default/eventlist)%>
<%else%>
<%archive(default/index)%>
<%endif%>

9. Finally, somewhere in the sidebar.inc file, add a link to your events blog so visitors can find your Events.

10. Add some CSS to your css file (default_right.css in the default skin). It might look like this:

.calendar {
position:relative; left: 100px;
width: 300px;
}
table.calendar {
  font-size: small;
  color: black;
}
 
tr.calendardateheaders {
  font-size: small;
  color: #ededed;
}
 
td.days {
  text-align: center;
}
 
td.today {
  text-align: center;
  color: #ededed;
  background-color: #696a64;
}

11. Now pretty it up and tweak it to meet your needs. You may want to have the main blog's category list appear in the sidebar of the events blog. In the sidebar.inc file where you see the categorylist variable, add the blogname parameter using the shortname of your main blog (mainblog in example): <%categorylist(default/index,mainblog)%>

Available SkinVars

  • <%EventBlog( (future[list]|past[list]|all[list]), (amount), (blogname), (templatename), (category) )%>
    • All parameters are optional
    • parameter 1: show “future”, “past”, or “all” items. default: all
    • parameter 2: amount of posts. default: 10
    • parameter 3: short blogname
    • parameter 4: name of template to use (see TemplateVars below for ways to display EventBlog information in templates.
    • parameter 5: category name if you want to only show items from given category
    • Example: <%EventBlog(future,10,events,default/eventlist)%>
    • Use: Index, Archive skin parts to list items in main content area
  • <%EventBlog( (future|past|all), (amount), (blogname), (templatename), (category) )%>
    • All parameters are optional
    • parameter 1: show “future”, “past”, or “all” items. default: all
    • parameter 2: amount of posts. default: 10
    • parameter 3: short blogname
    • parameter 4: name of template to use (see TemplateVars below for ways to display EventBlog information in templates.
    • parameter 5: category name if you want to only show items from given category
    • Example: <%EventBlog(future[list],1,events,default/eventlist)%>
    • Use: any skin part to list items away from main content area, like Next Show in sidebar
  • <%EventBlog(all,1, (blogname), (templatename))%>
    • All parameters are optional
    • parameter 1: show “all” items. default: all
    • parameter 2: show single post. default: 10
    • parameter 3: short blogname
    • parameter 4: name of template to use (see TemplateVars below for ways to display EventBlog information in templates.
    • Example: <%EventBlog(all,1,events,default/event)%>
    • Use: Item Pages skin part to list item,
  • <%EventBlog(calendar, (blogname), (category) )%>
    • parameter 1: “calendar”. Indicates you want to show calendar of events (using NP_EventCalendar plugin)
    • parameter 2: short blogname
    • parameter 3: category name if you want to only show items from given category
    • Example: <%EventBlog(calendar,events)%>
    • Use: Any skin part. Best used on Archives skin part and maybe a sidebar.

Available TemplateVars

  • <%EventBlog(var, (venue|street|city|state|zip|bill|cost|starttime|endtime|ages) )%>
    • Shows the appropriate field
    • Example: <%EventBlog(var,cost)%>
  • <%EventBlog(bgcolor, (oddcolor), (evencolor) )%>
    • use hex color values for oddcolor and evencolor
    • Example: <p style=“background-color:<%EventBlog(bgcolor,#ffffff,#cccccc)%>”>
  • <%EventBlog(map, (link text), (yahoo|mapquest|google) )%>
    • build a link with “link text” to map service
    • Example: <%EventBlog(map,Map It,google)%>

Options

  • Use Event Blog for music events (displays extra fields) - yesno, default: no. Indicate whether EventBlog is being used for music events. If so, extra fields are available.
  • Default template -text, default: default/index. Template to be used if no template is specified in the skinvar calls. The default/index (or any other) template will not display any EventBlog fields without modification to include EventBlog templatevars.
  • Delete this plugin's table and data when uninstalling? - yesno, default: no. Indicate whether EventBlog tables should be removed when the plugin is uninstalled (for instance, uninstalling may be part of a plugin upgrade, but you want to keep your data).

Blog Options

  • Enable Event Blog plugin: - yesno, default: no. Should EventBlog be enabled for this blog?

Tips and Tricks

Wishlist

Bugs

History

  • Version 2.00.01, released 08 November 2010
    • reworked to use some features in Nucleus CMS 3.60 that allow it to work without modifications to core files
  • Previous versions by gRegor for pre-3.60 installations
eventblog.txt · Last modified: 2010/11/22 22:25 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki