DigitalFriend Blog

June 2007

Inserting RSS fields into HTML files using the DigitalFriend

Monday, 11th

By: gosh@DigitalFriend.org (Steve Goschnick)

This item refers to the one below, posted on the 9th June (i.e. read it first). It details the usage of another very useful option within the DigitalFriend's RSS editor, that allows the automatic insertion of RSS data fields into an existing HTML file of the users choice. The user can select the RSS file to get the data fields from, and then select the HTML into which the actual data is inserted into. The option is accessed via the button labelled [Insert in HTML] in the bottom of Image#3 below. The HTML file needs to have a commented-out section (i.e. <!-- some comments --> ) which holds a few tags that the DigitalFriend understands are for it to process. The comment must start with the line: <!--<START_DIGITALFRIEND_INSERT>

and end with the line: <END_DIGITALFRIEND_INSERT>-->

any thing else in between the two should be HTML of your choice, with some embedded tags that identify the RSS fields that you want to insert into the HTML file. Here's an example:

<!--<START_DIGITALFRIEND_INSERT>
<div class="story">
<h1><DIGITALFRIEND_RSSITEM_TITLE></h1>
<p class="style14 style15 style16"><DIGITALFRIEND_RSSITEM_DATE></p>
<p><em>By: <DIGITALFRIEND_RSSITEM_AUTHOR></em></p>
<p><DIGITALFRIEND_RSSITEM_DESC></p>
</div>
<END_DIGITALFRIEND_INSERT>-->

This insert causes the DigitalFriend to put the RSS <Item> TITLE, DATE, AUTHOR and DESCription field values, into the HTML proper (i.e. below the commented-out tags). The DigitalFriend achieves this using simple macro-substitution. E.g. It was used to 'start' this news item I am currently writing, it replaced <DIGITALFRIEND_RSSITEM_TITLE> with the above title 'Inserting RSS fields into HTML files using the DigitalFriend' which originally came from the rss file: http://www.DigitalFriend.org/communication/rss-feeds/whatsNewDigitalFriend.rss. The inter-mixing of HTML code and the DIGITALFRIEND tags, lets the user add whatever HTML tags and formatting they like, to suit their current/existing blog style... expect to see more uses of this functionality, as it has great flexibility.

DigitalFriend RSS Editor now does Blog Entries

Saturday, 9th

By: gosh@DigitalFriend.org (Steve Goschnick)

The DigitalFriend has long had an RSS editor built-in, but we've just given it a new and simple feature, that's very useful for bloggers - using whatever blog tool you currently use. This feature lets you start a new blog entry via the rss file which reports that there is a new entry to be read. Its a case of: 'Which comes first the chicken (the new blog news article) or the egg (the rss item about the chicken)?' In our case the egg now comes first - the TITLE, AUTHOR, DATE and DESCRIPTION entries - are written first, in the DigitalFriend rss <item> input panel (see Image#3 below), then these are output into either an existing HTML file of your choice, or, as a small new file which holds just a fragment of HTML, that you can then paste or insert into some other blog file. Then in your blog tool/HTML editor, you write the entry in full. Then you post the new version of your RSS file that reports the new blog item, which is already updated because it holds the 'egg'. Let's look at the screens/menu items involved in this timesaving move:

Open rss file menu.

Image #1 : Open RSS File and New RSS File menus, access the RSS editor in the DigitalFriend.

The 'Open RSS file' menu option in Image#1 leads to a directory/file-selection dialog, in which you locate an existing RSS file to be updated with a new news <item>. You can also create a new RSS file (a socalled Channel) via the 'New RSS file' menu option above it - but its far more common to add new items to an existing channel (file). What follows here in Image#2 is the RSS Channel dialog window, giving you access to all data fields in the open selected RSS file, in this case, a file called 'whatsNewDigitalFriend.rss'.

Open rss file menu.

Image #2: The fields of interest making up the Channel-specific part of an RSS file.

Picking one of the existing 'Item's in the drop-down list of items in Image#2, then selecting the [Edit] button comes up with the RSS Item dialog window. The RSS Item dialog window appears in Image#3 below. Note: Picking the [Add] button in Image#2 also produces an Item dialog, but one with all new field entries, for your new news item.

Open rss file menu.

Image #3: RSS Item fields of interest, after selecting one of the items within the Channel dialog.

Notice the four buttons along the bottom of Image#3: [Save] simple saves the current field values into the RSS file; while [Save as HTML] saves a small fragment of HTML code into a new file called 'fragment.html'. On selecting the [Save in HTML] option, you get presented with a FUN file dialog (see Image#4 below), to locate the directory of your choice within the user's Knowledge Tree, to create the file 'fragment.html':

Open rss file menu.

Image #4: Open RSS File and New RSS File menus, access the RSS editor in the DigitalFriend.

Here's the example small bit of html-code created inside the file 'fragment.html', to be inserted in the user's blog:

<div class="story">
<h1>DigitalFriend RSS Editor now does Blog Entries</h1>
<p class="style14 style15 style16">Sat, 9 Jun 2007 00:49:07 +1000</p>
<p>gosh@DigitalFriend.org (Steve Goschnick)</p>
<p>The DigitalFriend has long had an RSS editor built-in, but we've just given it a new simple feature, thats very useful for bloggers. The feature lets you start a new blog entry via the rss file that reports that there is a new entry to be read. </p>
<p>&nbsp;</p>
</div>

I then just pasted that fragment into my blog/index.html file, and edit it to make 'this' particular blog entry you are currently reading. So, I now have this new blog entry (the 'Chicken'), and also the appropriately updated RSS file (has the 'Egg') on the www.DigitalFriend.org web-site which tells all interested that there is a new blog entry (i.e. whatsNewDigitalFriend.rss), as it was updated first - no re-entry of the Title, Author, Description, etc. - and the DigitalFriend user's life is just that little bit easier.

Home | Site Map | Privacy Policy | Contact Us | ©2007 Solid Software Pty Ltd