plainblack.com
Username Password
search
Bookmark and Share
Subscribe

Summary of next events

These are the basic instructions for creating an Upcoming Events area for your home page.  The same theory can be used to display a summary of other assets as well.  In short, you need to:

1) create a shortcut,

2) place it on your [home page], and then

3) edit the Shortcut Overrides to change the viewing mode.

Long instructions:

1) Begin by viewing the asset containing the information you would like to replicate in Admin Mode.  From the row of buttons that appear above the asset in admin mode, selecting the create shortcut button (it looks like a swooshy arrow).

2) Next go to your home page or the page where you'd like the your upcoming events or recent posts to appear.  In the clipboard on the admin toolbar you should see the shortcut to the asset.  Click on the shortcut in the clipboard and it should appear on the page.  Next click on the edit button for the shortcut (make sure you're clicking on the shortcut's edit button, not the asset's button just below it.)

3)In the shortcut edit mode, you will see the tab on the far right called "Overrides".  In this area, you can override all of the aspects of the asset the shortcut is pointing to.  In this case you'll need to change the default view to List.  There are other variables you may modify here as well which will regulate how many events are displayed among other things such as changing the title to "Upcoming Events".  

You may find that the default list view template needs to be modified to suit your purposes.  In this case, you'll need to follow standard procedure and copy the Default List View Template found in the Import node of the asset manager to whereever you keep your customized assets.  You can then edit the version you copied, return to the overrides in the shortcut and then select your modified template to override the default "List View Template".

 

Prior to WebGUI 7.6, the Event Calendar had no List View so the following workaround is needed. It may also be useful if you would like to view events from multiple calendars.

An SQL report may be used to circumvent this limitation. In addition, events may be combined from several or all calender assets available on your site. Something which would not have been possible by using a shortcut.

Creating your own summary is easy enough. Just follow theses steps:

1. Create an SQL report in the place were you want to have it.

2. Fill in the following SQL query

SELECT DATE_FORMAT(e.startDate, '%d.%m.%y') as date, ad.url, ad.title
FROM Event e
JOIN asset a USING (assetId)
JOIN assetData ad USING (assetId, revisionDate)
WHERE e.startDate >= CURDATE()
AND a.state = 'published'
AND e.revisionDate = (SELECT MAX(revisionDate) FROM Event WHERE assetId = e.assetId)
ORDER BY e.startDate, e.startTime
LIMIT 8;

It will fetch the next 8 events from all calendars on the site. Modify the format string passed to the DATE_FORMAT function according to your needs (see MySQL documentation for details). In addition, you may want to change the number of events retrieved by altering the number in the LIMIT statement. If you want to query events from a certain calendar asset only, add an AND a.parentId = '<asset-id>' criterium to the WHERE clause, whereby <asset-id> needs to be replaced by the id of the calendar asset.

3. Create a new template for displaying events. Usually it is best to copy the default template and replace the rows_loop by something like

<div class="eventSummary">
<tmpl_loop rows_loop>
<p>
<tmpl_var row.field.date.value>
<a class="contentLink" href="^/;<tmpl_var row.field.url.value>"><tmpl_var row.field.title.value></a>
</p>
</tmpl_loop>
</div>

4. Edit the SQL report asset to use the new style template you created.

Et voila! That's it.


Tested on WebGUI 7.4.38

 

Keywords: calendar events SQLReports summary upcoming

4perlDreamer: "A list view for the calender was added around WebGUI 7.5"
Search | Most Popular | Recent Changes | Wiki Home
© 2017 Plain Black Corporation | All Rights Reserved