| Contents:
Definitions
1- Feed Doors:

Above you can see a demo
image of some feed post, what you can see in the brown
text "inside boxes" is the Doors you are about
to learn how to create, and as you may notice doors
can be created in many different languages, in fact
you can create doors in almost any language so please
always use UTF-8 encoding when creating "doors
XML files".
P.S. I can't speack Chinese,
so if the chinease door above means something stupid
other than "Bookmark this" then please let
me know :)
2- Static Doors:
Doors that do not change
their value/text once they added to the post, Static
Doors are very easy to create, no need for 3rd party
scripting language, just basic XML and some or no XPath 2.0
knowledge at all.
3- Dynamic Doors:
Doors which will change
their value/text periodically according to the information
provided by your 3rd party script
Start
Building Doors
Manual
The best way to explain
how you can create a Door is to provide an example.
1- Static Doors
(any one can create Static Door, it's dead easy)
The following Example
shows you how to create a Static Doors, it's a simple
door you can add to your posts to allow visitors to
bookmark your post with "del.icio.us"
Service.
In the above example ${link}
and ${title} will be replaced with each post's
address and title automatically, you can also use any
XPath
Expression
XML Tag Description of the above
example
<FeedDoor></FeedDoor>:
opining and closing tags and the whole door will be
between these two parent tags.
<StaticDoor></StaticDoor> this
tag tells Feedoor that this is a static door, it contains
two child tags:-
a)- <Text></Text> : The value
of this tag will be the text that will appear on the
static door once it load.
b)- <link>: with "href" attribute,
the value of the "href" attribute will be
the link to the page where someone will be redirected
if he/she clicked on the static door.
2- Dynamic Doors (more
advanced)
Before creating Dynamic
Doors please consider the following:-
a) Creating Dynamic doors need some
knowledge in any third-party scripting language, such
as "Perl, PHP, Ruby.. etc"
b) The script you write in order to
generate the dynamic data need to be hosted in your
own server.
Now after making this clear, let's start
building Dynamic Doors :)
The following Example
shows you how to create a Dynamic Door, in this example
dynamic door will show number of words of the post's
title.
XML Tag Description of the above
example
<FeedDoor></FeedDoor>:
opining and closing tags and the whole door will be
between these two parent tags.
<Sample></Sample>:
will contain <text></text> child
tag, the value of this child tag will be just a preview
for members, since dynamic doors text changes periodically,
it's important to include a sample text to show
members and give them a good idea how thier door
will be like. "<sample> is not required in
static doors".
<DynamicDoor></DynamicDoor> this
tag tells Feedoor that this is a dynamic door, it contains one child:-
a)- <link>: with "href" attribute,
the value of the "href" attribute will be
a link to the third-party scripting file.
Now, How does
it work?
- a member add this
door to his/her feed
- When someone visit the feed,
every post will request the dynamic link "http://feedoor.com/examples/count_title_words.cgi?title=${title}"
${title} will be replaced with the post's title.
- count_title_words.cgi script
will read "title" variable content and count
number of words then sends back an XML format response
to Feedoor with the number of title's words.
- Feedoor
reads the response and print it.
So here's how your
response should look
By reading this response, Feedoor prints
the value of the text, so the dynamic door text wil
be "Title Contains 17 words" and when
someone click on that door he/she will be taken to http://feedoor.nom/examples/print.cgi?title=title
here. and will be sent there with the "GET" method
If another post has a title with; for
example "13" words, door text will be "Title
Contains 13 words"
You can apply this example in different
ways to produce some really amazing doors
Post Method
The above example sends request to your
3rd party script as "GET" query, but
what if you want for; example to count words of the item
's description, sending the whole description
with the GET method is not possible, so you need to
use the POST method
Let's use the above example to count
item's description words instead of
it's title by using "POST query".
Please note the difference
- instead of Type="get"
you see now that link's type changed to "post",
it's important to do this before sending POST query
- instead of passing variables with
the link, you can notice <field> tags now,
which act as the variable, field's name attribute is
the variable name, and field value is the variable value,
very simple just like any HTML form :)
So the above example will send a POST
query to the 3rd party script with"title,description"
variables, of course ${description}
and ${title} will be replaced with the description and
the title of the item automatically.
Here's the response example
Note that the clickable link can send
variables via POST method too.
Here's what will happen
when some one clicks on this door
Feedoor will send all
saved variables in it's cache along with the new variables
you defined above "custom" to print.cgi
as a POST query to print.cgi script.
Because Feedoor will
automatically send all saved variabales to your script
then there is no need to send back "title"
and "description" variables to the script
again unless you want to override the original values,
and the above is only an example.
Print.cgi script will simply
print out the title and the description of the post.
You can download this whole Dynamic
example Here
and please don't hesitate to join our developers forum
if
you feel confused.
Custom
Variable
One last thing before
closing this guide
If you created a static
or dynamic door, but this door needs from each member
to fill a field or more to customize his/her own door,
then you need to use Feedoor
Global Variables (FGV).
a quick easy example
to understand how you can use FGV with both static and
dynamic doors.
The following example
puts "Skype Us" door under all items.
Before going on with
this example, first lets analyze skype call link.
My skype call link is
"skype:mamod?call" in bold is my skype
name, and this is a variable, it has a different
value for a different user, so we need different members
to be able to change this easily. First we tell Feedoor
that this is a variable and will be changed immediately
when someone install this door by putting it inside
double square brackets [[ ]] . anything inside will be changed later.
Now for the Global Variables
you need to create
Name of the variable
must match the name inside double square brackets [[]] to be replaced with
that exact variable value, that's all you need to know
about Global Variables here, for more information about
FGV please go to Feedoor
Global Variables manual.
Submit
Your Door
Finaly you need to submit
your door, as any other application submitting doors
need you to login your Feeedoor account, go to developers
account page "http://feedoor.com/developer"
Click on Doors
button and click on "Add New Door"
Application (Door) Name:
Write you door
name, you can use any name you want but it's better
to select a relative name
Application (Door) Description:
Write a short description
for your doors, it's for members when searching for
doors
Application (Door) URL:
If there is
a page you want to link to then write the address here,
this is an optional field
Developer Name:
Your name.
obvious ha?
Developer Site: Your
site URL address if there is one "Free advertising
:)"
Application (Door) XML Content:
this is the most important
field, paste here your Door application XML.
Application (Door) XML Variables: paste
here door's Global variables, this is optional, only
if there is variables you want members to fill before
installing your door.
XPath
Expression
Feedoor supports XPath 1.0 expression,
you can use it any where within <text> and/or
<link> and it will be replaced with the requested
value, for example, if you want to pass the title of
"Feed" use the following XPath expression
${../title} note that you have to place any XPath expression
within ${} and note that because we want to get Feed's
title "not post title" we used ".."
because it's up one level otherwise it will get current
post title.
XPath expressions must be for RSS2.0
XML format even if your original feed is atom or something
else, feedoor will translate all feeds to RSS2.0
Some XPath expression
that you may find your self using a lot
|
XPath Expression
|
Value
|
|
${title}
|
This will select posts title.
|
|
${link}
|
This will select post's link.
|
|
${description}
|
This will select post's description.
|
|
${../title}
|
This will select main Feed's title
|
|
${../description}
|
This will select main Feed's description
|
|
|
|
If for some reason Xpath
didn't exist in a post the door will not show up.
For more information
about XPath Expression and lessons please visit w3schools
|