revjim.net

March 11th, 2003:

Inklog: your help is requested

Inklog, the weblogging system that I am authoring, is stuck on one small (yet, oh so large) point, and I need your help to decide what to do. I’m pivoting between MORE flexibility and MORE usability and I need to know how you would prefer your weblog, image gallery, content manager, todo list, DVD collection catalog, and discussion forum software to operate.

I am fighting between making Inklog more FLEXIBLE or more USABLE. Most immediate reactions are to go with more USABLE. However, I’m not sure that the more FLEXIBLE method is really any less USABLE. That’s where you come in. I’m going to give you two scenarios for a method of configuring how your personal weblog acts and functions. All I need you to do is tell me which method you would prefer to use. Additionally, if you can think of other ways to handle the same task, I’d be happy to hear them.

This may be a bit difficult to grasp. Sometimes I don’t express myself as clearly as I should, so please bear with me and ask for clarification in any places that seem difficult to understand. Additionally, please remember that the syntax is not what we are discussing. Instead we are discussing how the system will get from point A to point B.

Introduction

Assume you have a weblog that is broken into categories. You also have a small photo gallery, and a collection of quotations. You’ve decided that, instead of just displaying your weblog entries on the front page of your website, you’d also like to include the folllowing items:

  • The most recent photograph that you’ve placed in your gallery.
  • A random quote.
  • A list of categories from your weblog.

You also decide that you would like those items to appear on every page in your entire site, including your “about me” page.

At this stage, you’ve already designed your site and have two files representing that design. The front page is called frontpage.tpl and the about me page is called aboutme.tpl. Additionally, you’ve made a file called sidebar.tpl that holds the recent gallery image, random quote, and your list of categories. You’ve placed this in a separate file so that you ony have to type out the HTML for that part on every page in your site. Now, all you need to do is tell the system what you want so that it will fill in the blanks in your site design.

Below are the various files that you have written. Where you see notation like {$somevar} you are anticipating that the system will substitute data into that location. It is just like using <$MTEntryTitle$> in MovableType. Where you see the {foreach} style notation it is simply a loop, just like using <MTEntries> in MovableType.

Here is your frontpage.tpl file:

<html>
<body>
<h1>My webpage</h1>
<h2>Front Page</h2>

<div style="float: right; border: 1px;">
{include file="sidebar.tpl"}
</div>

{foreach from=$entries item=entry}
<h3>{$entry.title}</h3>
<p>{$entry.text}</p>
{/foreach}
</body>
</html>

Here is your aboutme.tpl file:

<html>
<body>
<h1>My webpage</h1>
<h2>About Me</h2>

<div style="float: right; border: 1px;">
{include file="sidebar.tpl"}
</div>

<p>I am really really cool.</p>
</body>
</html>

And, finally, here is your sidebar.tpl file:

<h3>The SideBar</h3>
<h4>Recent Photograph</h4>
<img src={$photo.url} />

<h4>Random Quote</h4>
<p>{$quote}</p>

<h4>My Categories</h4>
{foreach from=$cats item=cat}
{$cat.name} - {$cat.numofitems}<br />
{/foreach}

Please make sure you go over the above three files to ensure that you understand what is taking place there. It is important that you realize that these files are merely serving as a skeleton of the final site and that creating them is very similar to creating MovableType templates. Additionally, the syntax of these particular files is not what is at question. This is only an example.

Method 1

This method involves altering the template files (aboutme.tpl, frontpage.tpl, and sidebar.tpl) to gather the information they need.

This would involve placing something similar to the following at the top of frontpage.tpl:

{getentries num=10 assign=entries}

Likewise, the following would be added to the top of sidebar.tpl:

{getphoto num=1 assign=photo}
{getquote assign=quote}
{getcats assign=cats}

aboutme.tpl would not need any modification, since none of the data in it is dynamic.

Method 2

This method involves having a separate configuration file that accompanies each template file (optional). There will exist a Smart include method to ensure that the config files are read.

First and foremost, the {include file=...} syntax that was used in aboutme.tpl and frontpage.tpl will need to be changed. No longer will you use your template engines include funtions. Instead, you must treat the included subtemplates as regular variables. Therefore replace both instances of the {include} syntax with the following:

{$sidebar}

Secondly, a configuration file will determine what gets loaded into where, and what template files will be used to display them. Therefore, we’ll create frontpage.config and it’ll look something like this:

$entries = getentries(num => 10);
$sidebar = executenode('sidebar.config');
show('frontpage.tpl');

Additionally, we’ll create a similar file called aboutme.config:

$sidebar = executenode('sidebar.config');
show('aboutme.tpl');

Finally, we need to create the sidebar.config that these files reference:

$photo = getphoto(num => 1);
$quote = getquote();
$cats = getcats();
show('sidebar.tpl');

Method 3

You tell me. Is there another way to do this? Is there a better, more userfriendly, equaly flexible method of allowing users to input data from any module in the system in any way they desire.