Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

A New (Pre-Processed) CD Site

Ah... finally got enough of my new site into CD and working to upload it.

However, I don't think I'm using CD in the 'normal' manner...

Within my Articles in CD I have a range of 'TAGS' (comments) of my own. These tags are used by our Invoicing System, of all things, and are automagically updated in CD whenever a change is made to a price list, or a new version of a file uploaded etc.

Until now, doing these steps was a major pain. Automating and integrating it with CD has made me a free man again... Ok, not quite yet, but I'm working on it ;-)

To see the what I mean about my pre-processor have a look at the order page:
http://www.serveradmintools.com/Orders/

Here the price table is automatically updated in CD every time a price is changed in our invoicing system. No editing of CD is required. Just change the price and republish!

Similar templates are used on the product pages e.g.
http://www.serveradmintools.com/Products/MacroScheduler

To get the prices, buttons, and download links correctly setup. Same generic pre-processor, just different tags. It doesn't matter if the Magic Names change, the preprocessor knows how to find the right images etc.

The same concept even works for the free download list - if a newer file is uploaded to the server, the list on this page:
http://www.serveradmintools.com/Downloads will be updated the next time the pre-processor is run and CD published.

CD does what it does best, and still allows me to extend it to FINALLY make automating my routine activities a reality.

I'll be starting work on updating the other sites soon using this same method, something that has been put off for months due to the amount of time it takes to sync everything up!

Thank you CD (and Terry's archives)!

Fingers crossed when V2 comes out it won't be a total rewrite for me. Right now I couldn't care if it did, I'm just so damn happy this is all working... automatically ;-)

Tim Jones
Tuesday, November 12, 2002

Nice work Tim.  I don't quite know what you mean by pre-processor though.  I see the results but don't quite understand what pre-processing does and where it takes place.

tk
Tuesday, November 12, 2002

Looks nice! I am also interested in what you mean with a preprocessor. Did you couple a invoice system, or are other people updating the Extra1/Extra2 fields of articles with current prices etc.?

And what is {CODE=MS_SU} for ? (from the source)

Adriaan van den Brand
Tuesday, November 12, 2002

Terry

The 'pre-processor' part (that now lives in the invoicing system) simply looks for my TAGS, like the one Adriaan found: {CODE=MS_SU}, within Articles in CD.

When it finds one of those TAGS in an article, it then examines the context of the TAG. i.e. Is it an 'order tag', or a 'download tag' or whatever.

From that information it determines what HTML source has to be inserted into the CD Article to get the right information in the right places.

It does this by knowing the filenames of the buttons (from a template), and locating them in the CD tblStructure/tblFiles/tblArticles tables and creating the relevant Magic Names to insert.

So in my case. When in CD, I type {CODE=MS_SU} as the TAG in the HTML screen. I am asking my pre-processor to insert the relevant code into the Article for creating an 'Order Link' for the product MS_SU.

The actual HTML for that is built from a template - fields, colours etc are filled in at pre-processing time according those templates. So the SAME TAGS in one CD site, may generate completely different code/look in another CD site!

If I want to add new products to the order or download tables, I simply:
- Add another TAG to the CD Article,
- Run the Pre-processor
- Start CD and Click Publish.

I don't actually 'do' anything other than add that TAG.

Hoping, I'm explaining it a little better this time?

Tim Jones
Tuesday, November 12, 2002

Adriaan,

Yes - I have basically coupled our invoicing system with CD!

No updating of *anything* in CD is needed for keeping pricing & files updated correctly on the web sites now.

"And what is {CODE=MS_SU} for ? (from the source)"

That is one of the TAGs the pre-processor looks for in a CD Article. When it finds one of them, it strips out ALL the existing HTML upto the next TAG, and then replaces it with the pre-processor generated 'new' HTML based on the information currently in our invoicing DB.

In it's most basic form, a TAG block would look like this:

<!--{CODE_BLOCK}-->
    <!--{CODE=MS_SU}-->
    <!--{CODE=MSV_SU}-->
    <!--{CODE=RA_SU}-->
<!--{CODE_BLOCK}-->

Then depending on which template I apply to it, it could end up as any of the three different pages I listed above.

Taking this approach has given me all sorts of ideas for things I can now accomplish using CD. In theory I could build a generic pre-processor that could retrieve information from other data sources, and update it in CD automatically as well.

Have I explained it any better now?

It's sometimes a bit hard to get the concept conveyed across when I'm still so excited at the differences it has made for us :-)

Tim Jones
Tuesday, November 12, 2002

Thanks for the explanation Tim. I hope the next version of CD will not mean that you need to do everything different, just that it will provide easier ways of doing it.

My compliments for your creativity. I have found server side scripting as a way to solve the limitation of Citydesk whilst still using its strengths. But preprocessing is another interesting way.

Do you update the citydesk database with your preprocessor, or do you parse the generated files before FTPíng them in your own application?

Adriaan van den Brand
Wednesday, November 13, 2002

Adriaan,

"My compliments for your creativity."

Thanks, I've just got to learn when to stop now ;-)

"I have found server side scripting as a way to solve the limitation of Citydesk whilst still using its strengths."

I started down that road, but I *really* wanted to keep all the data/code in CD, and this way Preview works properly for me too.

"Do you update the citydesk database with your preprocessor"

Yes, it updates the articles in the .CTY file directly, then I just use the CD Publish function to do the updating as it does normally.

Simple, neat... and bewdiful :-)

Tim Jones
Wednesday, November 13, 2002

*  Recent Topics

*  Fog Creek Home