About SimpleBooks
SimpleBooks is, as it is named, a simple proof-of-concept for my idea for
publishing articles or "books" of various formats and organizations on the Web.
The idea is based on the principle that the content should be easy to produce
and publish. It should be self-contained in the file system, not hidden in
database tables. It follows that the description of content organization
(articles, sections, chapters, or similar) should also be a file in the file
system, in the same place as the content. The description should support
"paging" through articles or chapters. Content should be heirarchical, so
that the concept of a book could be supported with chapters, appendices, and
other sections. While this proof of concept involves Web pages as content,
clearly that content should also include PDF, audio, video, or other media that
can be delivered on the Web.
The SimpleBooks approach delivers some great things from my perspective.
First, I can use any old HTML editor to create content on my workstation or from
a Website. I can simply copy that content to a publishing directory on a
Website and it automatically becomes available there, without additional
programming. Unlike most of the major blog engines, if I choose to publish
a blog this way, I can backup my posts easily and transfer that content between
Websites easily. Frankly, this simple blog publishing technique is far
more attractive to me than conforming to the MetaWebBlog API or someone's
specialized API (or worse, a specialized implementation of the MetaWebBlog API).
In a race between an API and FTP, FTP is the clear and undisputed winner.
If you think FTP is dangerous, implement your own SimpleBooks API (hint:
whatever you do, don't call it file upload and download. Not so sexy.).
SimpleBooks also provides super flexibility for the content. Consider
this: the content may be hosted and accessed using the basic SimpleBooks classes
and controls, but all the trappings of a complex posting system can be layered
on top of that. For example, a full-featured blog could be built with
SimpleBooks. A full-featured Wiki could be built with SimpleBooks.
Specialized social networking applications could be built with SimpleBooks.
While it is true that some of these systems can be very involved and complex,
the portability and simplicity of SimpleBooks can easily be retained.
SimpleBooks uses BookIndex.xml files in each directory, which organize the content for SimpleBooks.
Check the sample SimpleBooks project for examples of the XML. The "toc" tag, or "Table of
Contents", contains information about the content in the directory, at that
directory level. SimpleBooks constructs a data tree of content based on
the BookIndex.xml file for a root directory and every subdirectory that contains
a BookIndex.xml file. This is contained in a programming object called
"BookTree". The application actually requests BookTree objects through the
"Library" class method "GetBookTree", which also caches BookTree objects and
supports multiple "Book" content trees in the application file system.
My apologies for the poor programming techniques of this sample application.
I hope that the code is readable and it appears to do the basic functions I
wanted in this proof of concept. All assertions that SimpleBooks is a POS
instead of a POC are baseless.
The BookIndex.xml file lists the articles in the directory. Each article
consists of one or more pages, each with an HTML file. Each article may
have a content folder, which can contain page graphic files or other non-html
content linked through an article page.
The text displayed for links is provided in the BookIndex.xml file. The
display text for each element is provided by the "title" attribute in the XML.
The SimpleBooks system, on the other hand, uses the "reftitle" attribute in the
URLs for articles. The directory levels are specified as for the file
system from the root directory of the "book". The article page number is
also part of the URL. This is where the UrlRewriteNet component provides
something that SimpleBooks can use, as it takes any URL that references the
"book" root directory, removes the text after that reference, and provides that
text in a query string for the BookSections.aspx page.
Original link:
http://SimpleBooks/Book/Subdir/Article/Page.aspx
Becomes:
http://SimpleBooks/BookSections.aspx?PageRef=Subdir/Article/Page
Once the BookSections.aspx page gets the PageRef, the rest is just coding.
This project uses
UrlRewritingNet.UrlRewrite
. I personally recommend this component for its high quality, ease of use,
and utility. When somebody writes a "UrlRewritingNet for Dummies" I may be
able to use the full power of this component.
I also used Omar AL Zabir's
UFrame
to display the articles in the BookSections page. UFrame has ideal features
for this kind of application. First, it plays well with Javascript and
Ajax. Second, it allows the content to use its own CSS files. Last,
it isn't IFRAME.
The Visual Studio 2008 SimpleBooks Project
Note: This is a revision of the original article and project published
8-17-2008.
-- Walter Lounsbery, 8-20-2008
http://www.Lounsbery.com