How to Add an EventKeeper Feed Using a Sidebar Widget

To the right you’ll see an example EventKeeper feed. This feed is being displayed using Javascript and a text widget.

Here’s how to do it:

Login as an ADMIN to your EventKeeper page and go to the ADMIN PAGE.

On the EventKeeper ADMIN PAGE, click CREATE in the Multipublishing section to create a new EKFeed.

Here are the parameters used to build this example feed. Note that we are using an ARRAY VARIABLE:

EK_feedmaker_example1

Click CREATE SAMPLE DISPLAY
Click CREATE THE JAVASCRIPT SNIPPET AND SAMPLE FILE
You will see the link to copy and paste into the HTML of your page. It looks like this, where YOUR_FEED_NAME is the name you gave your feed:
http://www.eventkeeper.com/ekfeed/YOUR_FEED_NAME.js

Your Web Developer must use javascript to format and display the event data. If you do not have a Web Developer, you can use our example code below as a starting point. This is provided simply for illustrative purposes. Insert your feed name for YOUR_FEED_NAME and your organization’s code for YOUR_ORGCODE.

In your WordPress Dashboard, go to Appearance=>Widgets. Add a text widget to your sidebar and insert your code.

http://www.eventkeeper.com/ekfeed/YOUR_FEED_NAME.js

// new variable to handle long event names
var maxNameLength = 50;

// EventKeeper first returns a javascript variable called fString for FeedString
// which tells us what varibles are returned.
// characters in the string can be:
// D : date
// T : time
// N : name
// 1 : keyword 1
// 2 : keyword 2

// EventKeeper has created an javascript array variable called evtArray
// with fields = evt_date, evt_time, evt_name, evt_ID, evt_Key1 and evtKey2

// for this example we write out the data from this array in a table.

// outer table
document.write(”

“);

document.write(”

“);

// inner table with event data
document.write(”

“);

// loop through the array, creating a table row for each row in the array.
for (i=0; i”);

// for demonstration purposes, we check FeedString.
// Since you know what data you’ve asked for you can hard code the array.
if (FeedString.indexOf(“D”) != -1)
document.write(”

” + evtArray[i][evt_date] + ”

“);

if (FeedString.indexOf(“P”) != -1)
document.write(”

” + evtArray[i][evt_date] + ”

“);

if (FeedString.indexOf(“N”) != -1)
{
{
// handle long event names
var theName = evtArray[i][evt_name];
if (theName.length > maxNameLength)
theName = theName.substring(0,maxNameLength-2) + ‘…’;

// create the hyperlink based on the Event Name and the Event ID

var linkurl = ‘http://www.eventkeeper.com/code/events.cfm?curOrg=YOUR_ORGCODE’;

linkurl += “#” + evtArray[i][evt_id];
var namelink = ‘‘ + theName + ‘‘;
document.write(”

” + namelink + ”

“);
}
}

if (FeedString.indexOf(“1?) != -1)
document.write(”

” + evtArray[i][evt_key1] + ”

“);

if (FeedString.indexOf(“2?) != -1)
document.write(”

” + evtArray[i][evt_key2] + ”

“);

document.write(”

 

“);
}
document.write(”

“);

// if you would be so kind, please include a reference to EventKeeper
var EKNOTICE = ‘Powered by‘;
EKNOTICE += ‘ EventKeeper‘;
document.write(“
” + EKNOTICE + ”

“);

// close the table tag
document.write(”

“);

Leave a comment