Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

database instead of articles

I'd like to use Access tables instead of articles.

Scripts would "select" fields in the tables.

Since CD uses Access anyways, maybe it's not a big deal to build in a way to use user-defined-tables.

It is easier to use (relational) tables than articles for keeping lists of links, contacts, and other data for presentation on a site. The fields associates with articles are tremendous, but they only go so far.

Bob Bloom
Tuesday, September 02, 2003

How do you access a field associated with an article?

Txs

Ram Dass
Tuesday, September 02, 2003

From the CD help:

This CityScript: Is Replaced With:
{$.headline$} The article headline
{$.author$} The article's author
{$.body$} The article's body
{$.modifiedDate$} The date that the article was last modified
{$.modifiedTime$} The time that the article was last modified
{$.filedDate$} The date that the article was filed
{$.filedTime$} The time that the article was filed
{$.keywords$} The keywords of the article
{$.teaser$} The teaser
{$.sidebar$} The sidebar
{$.about$} About the Author
{$.extra1$} The Extra 1 field
{$.extra2$} The Extra 2 field
{$.link$} A relative link to this article, for example, MyArticle.html
{$.absLink$} An absolute link to this article, for example, News/Articles/MyArticle.html
{$.fileName$} The name used for the article in the main window

Bob Bloom
Tuesday, September 02, 2003

I agree with you, Bob. Even if it was a very simple mechanism, I could do things like have a list of books and then generate Amazon.com links to them. Or have a table of names, addresses and phone numbers that I can sort, filter, and loop over.

It's a bit of a pain trying to edit lots of individual articles to achieve the same effect.

Darren Collins
Tuesday, September 02, 2003

One possibility would be to add a tool for doing something like advanced asp-like scripting. For instance, process all <<%...%>> blocks client-side before the files are copied to the server. This way you could leverage VBScript or JavaScript and get full access to whatever database or whatnot you might have on your machine.

Of course, if you need this much power, you should probably consider using a different system.

Again, I could probably whip up a small tool to do this, but it would take slightly more time than the "entity character fix" I posted earlier so I'll get back to this later.

Lasse Vågsæther Karlsen
Wednesday, September 03, 2003

Although the tool is not ready for distribution yet, I have updated my website with an article using the scripting system.

Take a look at:
http://www.vkarlsen.no/Articles/CityDeskStuff.html

The tool will be available for download, with source, when I've tested it some more.

Lasse Vågsæther Karlsen
Wednesday, September 03, 2003

Lasse,

Sounds very interesting!

Something I did a while back was to integrate some of my CD sites with our invoicing program & database.

For example, in an article I can place a marker tag, usually a HTML comment, that the invoicing system looks for. When it finds one of these tags, it deciphers it, and then replaces it with the appropriate templated code with blanks filled in from the invoicing database.

Yes it requires some custom programming upfront, but not much more than active scripting, plus it only needs to run when something changes, not every publish.

I'm still interested to see Lasse's implementation though as I'm sure I'll dream up some interesting ways to use that too :-)

Tim Jones
Wednesday, September 03, 2003

Although a "kludge" in some senses the Links, .NET WebLogs, and Last 40 Articles on my homepage (http://www.schkerke.com) are all created using CityScript.

I create a folder inside CityDesk and then execute the following code:

$ foreach x in (folder "Links") SortDescendBy .headline $}{$x.headline$}  {$x.teaser$}

You could create a direct link to the remote site by inserting the link destination into extra1 or extra2 and doing something similar to..

<a href="{$x.extra1}">{$x.headline$}</a>

This way I just add an article to Links or Weblogs and I'm off and running.

-- Brian Schkerke

Brian Schkerke
Saturday, September 13, 2003

*  Recent Topics

*  Fog Creek Home