revjim.net Rotating Header Image

InkLog: nodes explained

Phil Ringnalda posed, as always, an
interesting
question
in regard to Inklog and its nodes that warrants a detailed
response. Phil wrote:

It sounds to me like you are heading down the right path [with
InkLog]: I have very little interest in feeds, and an intense interest in
items. Non-Inklog, you would have a feeds table to keep track of channel info,
and an items table with items including their feed_id. Inklog nodes I don't
quite get: how do they know about their relationship to other nodes? Does a
weblog post know that it's in the Inklog category, or does a category node know
the node_id of every weblog post in that category?

The best way to explain a node is that it is like a file in a file system
with additional, arbitrary metadata available. Every file has a name, a date, a
directory that it lives in, and, of course, data. There are three tables
involved with each node: one to hold the node, one to hold the nodes metadata,
and one to hold the directory that the node lives in. InkLog has no real notion
of a "Category". Instead, it leaves organization up to the user and the module
authors.

One could, for instance, place all the blog entries in the "/blog" path.
Then, for categorizing, use a "Category" metadata property. Also, a user could
use the paths as categories, placing the "Technical" blog entries in the
"/tech" path, and "Technical" entries about "Computers" in the "/tech/comp"
path. Obtaining a list of categories, in either case, would be a simple one
liner. None of this has been written yet, but I can make up an example that
would be similar to actual usage. If one were using paths as categories,
getting a list of categories in the "Technical" category might look like
this:

<il:getPaths from=/tech assign=cats />

Getting ALL the categories might look like this:

<il:getPaths from=/ assign=cats />

Getting the 10 most recent nodes from the "Technical" category might look
like this:

<il:getNodes from=/tech num=10 assign=nodes
/>

If one decided to use MetaData as a category specifier, one might use syntax
like the following:

<il:getUniqueMetadataValues mdName=Category From=/blog
assign=cats />

Or:

<il:getNodes from=/blog
mdInclude=Category:Technical num=10 assign=nodes />

If, for some reason, one didn't like either of those methods, and couldn't
come up with one that suited them using the existing framework, extending it is
as simple as writing a single PHP function that gathers the data, putting that
function in a file, and sticking that file in a directory. Most beginning PHP
programmers could do it.

Now to speak more directly to how the RSS reader in Inklog might work. This
isn't set in stone. In fact, I'm making it up right now. However, it sounds
pretty good. You would first create a node of type "feed" in whatever "path"
you would like to see those RSS items in. "/reader" might be a good choice.
Additionally, one might choose "/reader/life" and "/reader/tech" and
"/reader/photo" depending on the content of the blog. The data for this node
would be two lines: the first being the URL of the feed, and the second being
the refresh time for that item. When a new RSS item is encountered in any feed,
a node of type "feeditem" will be created in the same "path" that the feed node
is in. A Metadata item with the name "FromFeed" will be added to the "feeditem"
node and it will be set to the ID number of the "feed" node =66rom which it
came. The feed reader itself would be executed by issuing a simple statement
like this:

<il:getNodes from=/reader itype=feeditem num=10 assign=nodes
/>

Additionally, the cron job portion of the RSS reader will also store channel
information in the Metadata for the feed node itself. If one would like to
create a blogroll showing all the feeds they read, it might be done like
this:

<il:getNodes from=/reader itype=feed assign=feeds
/>

Thanks for such a great question, Phil. I hope I've answered it.

Share and Enjoy:
  • Facebook
  • StumbleUpon
  • Digg
  • del.icio.us
  • Google
  • Reddit
  • Technorati
  • Furl
  • Spurl
  • Live
  • Pownce
  • TwitThis