Server-Side Inclusion

The more powerful method is server-side inclusion (SSI). It allows you to parse the feed using any technique and any language you like, and it allows greater flexibility for how the feed is used.

Let’s look at an example of how it works. Example 8-10 produces an XHTML page with a server-side include directive.

Example 8-10. An XHTML page with a server-side include
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>An Example of a SSI</title>
</head>
<body>
<h1>This here is a News Feed from a really good site</h1>
<!--#include file="parsedfeed.html" -->
</body>
</html>

A server serving the page in Example 8-10 will, if the server is set up correctly, import the contents of parsedfeed.html and insert them in place of the SSI directive <!-- #include file="parsedfile.html" -->.

So, by parsing RSS files into XHTML and saving them to disk, you can use SSI to place them within an existing XHTML page, apply formatting to change the way they look via the site’s CSS stylesheet, and present them to the end user.

Enabling Server-Side Includes Within Apache 1.3.x

Turning on server-side includes within Apache is straightforward, but it involves delving into places where a wrong move can make a nasty mess. Have a coffee, then concentrate.

Tip

This section discusses Apache Version 1.3.x. Apache’s configuration structure may change in later versions. Consult the ...

Get Developing Feeds with RSS and Atom now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.