If you have never head of Klip from Serence Inc. then your content based site is definitely missing something.
Klip from Serence Inc. will give your website the ability to get your content out.When you have a large reader ship such as Slashdot (www.slashdot.org) or you have a much smaller readership it?s distribution is even more vital.
Klip (www.serence.com) is a persistent and proactive desktop information channel used by consumers and knowledge workers to stay up-to-date with ever-changing content or services.
Please keep in mind that generating KlipFood is only half the story. Fortunately, building the KlipFood is pretty easy and they only need to do it once. A template you can work from is available in the dev kit on the Serence site (http://www.serence.com/provider.php?page=dl_home)
Understanding what is involved
Adding Klip to your site isn?t really all that hard.However, there are a few things you will need to know before beginning the code.
1)The KlipFood files which get the content to the program, are kept on your hosting server.Therefore you will be using your server bandwidth when the software makes requests.Since the Food files are text files with code this should not be a problem.
2)The average update time for a Food file is every 120 minutes.So be sure that you content is constantly being updated.
3)Before starting to develop your asp files please go to www.serence.com/provider.php and signup to be a provider.At the site there are examples, information and files you must supply.
Since Serence Inc. made there own specialized language for the KlipFood you will need to refer to their documentation. If you would like to evolve your Food files past the scope of this tutorial.
Developing your KlipFood with .FOOD extension
The example below generates a list containing the top 3 developer articles, news articles and code snippets.Then creates the food file from the results.
Setup the header of your asp script;
<%LANGUAGE=?VBSCRIPT? CODEPAGE=?1252?%>
Dim strDevel, intDevel, strNews, intNews, strSnippet, intSnippets
Include whatever file it is that you are using to connect to your DSN or custom connection string.First I have declared my variables and then re-declared them as static arrays.If you are going to be adding more then 3 items per connection then I suggest using a dynamic array instead.
Set rsDevel = Server.CreateObject(?ADODB.Recordset?)
rsDevel.ActiveConnection = devbuilder
rsDevel.Source = ?SELECT * FROM DEVELOPER_ARTICLES ORDER BY UNIQUE_ID DESC?
rsDevel.LockType = 1
rsDevel.Open()
Here I have opened a Recordset named rsDevel to the DSN named devbuilder.The SQL connection string is basically just giving me a list of the developer articles with the highest auto number at the top.
If Not rsDevel.EOF Then strDevel(0) = rsDevel(?HEADLINE?)
If Not rsDevel.EOF Then intDevel(0) = rsDevel(?UNIQUE_ID?)
RsDevel.MoveNext
If Not rsDevel.EOF Then strDevel(1) = rsDevel(?HEADLINE?)
If Not rsDevel.EOF Then intDevel(1) = rsDevel(?UNIQUE_ID?)
As long as you modify this code for your connections and obtain the information that you are looking to have published you are good to go.
Deleting the old KlipFood file
Before you can add information to the food file you will need to delete the old file.This will insure that your data on the channel is new and clean.
Dim fs, f
Set fs = Server.CreateObject(?Scripting.FileSystemObject?)
Set fs = fs.GetFile(?d:\inetpub\yoursite.com\klip\klipfood.food?)
f.delete
Set f = Nothing
Set fs = Nothing
Great! Our file is now history.
Making the KlipFood
This function will set us up to create a new file with the information that was compiled above.Therefore, updating all your channel users.
Function WriteToFile(FileName, Contents, Append)
If Append = True Then
iMode = 8
Else
iMode = 2
End If
Set oFs = Server.CreateObject(?Scripting.FileSystemObject?)
Set oTextFile = oFs.OpenTextFile(FileName, iMode, True)
oTextFile.Write Contents
oTextFile.Close
Set oTextFile = Nothing
Set oFs = Nothing
End Function
Feeding the KlipFood
Now update the variables that will actually enter the information into the KlipFood file.
strFile = ??
strFile = strFile & ?0?
Purging your file is very important if you are looking to not have a run on channel.The channel will automatically keep any old data that is not in this KlipFood file but has been seen by the user.Therefore, you will want to remove any old data so the user only sees the newest information.
What it does is force the Klip to only show items within the .FOOD file, rather than hang on to old items. KlipFolio offers end users the ability to decide how long items should hang around (1,3 or 5 days).
For example, say a site has 5 headlines on their home page today. Their .FOOD file will also likely have just those 5 items. However, some users may want to see yesterday's 5 headlines as well. The Klip will hold on to the 5 old headlines for 1,3 or 5 days, as per the user's preference (for a total of 10 headlines in the Klip).
What 0 does is tell KlipFolio to remove anything not present in the current .FOOD file, ignoring the user's 1,3 or 5 day auto-remove setting. Therefore, no matter what, the user will only see today's 5 headlines.
The Alternative to purge
There's an alternative to that is much, much more useful to developers. It's the "iid" item attribute. What "iid" does is slap a persistent unique identifier on each item. This way a developer can change an item whenever they want without the end result being near-duplicate items or a complete purge of old items.
For example, say a developer found a typo in a headline. It's already gone out to their Klip users because it's been in the food file all morning. If the developer was not using "iid" and corrected the typo, each user would see 2 similar headlines, one with the typo and one without. The developer could use to correct the problem, but that would destroy all the old headlines a user might still have been looking at.
What "iid" does is allow the developer to change the typo without the end result being a new item. Because the item's "iid" has not changed, KlipFolio treats it as an update to the same item rather than a new one.
"iid" is also very handy for developers who want to include always-changing information as part of each item. For example, look at article comments. The item can be "News story - 4 comments". As the day goes on and each time the food file is regenerated, the number will go up. To make sure the title changes to "News story - 7 comments" rather than have a brand new item show up, the developer should use the same "iid" for all generations of that item.
If you would like to add the iid to your KlipFood file you would need to use an auto incrementing number to insert the iid.If you wanted to edit a KlipFood item then you program would need to understand how to specifically edit that item keep the iid.
Another neat feature of .FOOD is . It's what shows up in an item's tooltip and is pretty easy to generate. It's also immensely useful to Klip users. Most of the time, it's an abstract of an article or the first few lines.
Basically enough info to let the user make a better decision as to whether or not they should check out the article. can be anything; an abstract, snippet, posting date, number of comments, latest comment, etc.. It also obeys the "iid" attribute (as does actually) so it can change without the item being duplicated in every instance of the Klip.
Getting your Klip to constantly update
Ok, well so far we have obtained our content, deleted our old Food file, compiled the content and created a new Food file.Now we need to get the script to run when we want it to.For that there are a couple of options.
If you are the only one who adds content to your website then maybe having a hidden page that you can browse to is the solution.
If there are more people then just you updating the content on your website at all times then it is best to have the page hidden in with the rest of the site.To do this pick a page that is hit often but not beat to death.Then use the command <%Server.Execute(?asp/create_klip.asp?)%>.This command will actually cause the create_klip.asp page to run independent of the current page the user is looking at.
Conclusion
In conclusion we have found a way to get our information out to people without them having to browse to our website every minute.In this day and age internet usage is being cut down on by corporations so if you are able to use this tool wisely you will be able to get your content to them.