Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Why use magic names in templates?

I'm new to using City Desk, so I'm still developing my "best practices" approach to site construction. In reading through the documentation and discussion topics, I can readily understand the underyling rationale for the "magic names"  used when adding content through the CD user interface, but so far I've avoided using magic names in my template building.

If there's a specific advantage to using them, I'd appreciate hearing about it. But at first glance they appear to be more trouble than they're worth. Aside from not being intuitive names that I can type from memory as I code, they create pathing problems in my server-side includes. Yes, there are workaround for this, but I haven't seen a persuasive rationale for using them instead of the simple, straightforward approach of hard-coded relative paths.

As background, please note that I'm very comfortable with HTML source code, so I'm creating all templates and includes files from scratch either in the CD editor or in Homesite.  My users should never have to open those files to edit any aspect of the design.

I've also read a few messages promoting CD alternatives to SSI, but since I'm really comfortable with an SSI approach I couldn't see the rationale for changing just because it *could* be done differently.

Does it all boil down to personal preference? I've built several sites using Microsoft's Content Mangement System, and as a matter of course we (programming team) always kept a rigid distinction between our design files and the user content files. Users had access to all the resources (aka magic name files), but the design/programming files were hard-coded into the templates.

Carmen Carter
Friday, June 27, 2003

The advantage to magic names is that it will create a relative link to any document from any document.

So if you have a link on every page to

mysite.com/about.htm

Citydesk will build the appropriate link:

about.htm
../about.htm
../../about.htm

And if you ever move or rename about.htm, CityDesk will change all the links to the right NEW link. Sure you could create the link using absolute links all the time, but that prevents you from previewing your end product until you publish, which is one of the disadvantages of SSI.

Also if you have a heavy-traffic site, CityDesk creates static pages, which is good on CPU cycles.

www.MarkTAW.com
Friday, June 27, 2003

Mark,

Thanks for the reply.

I haven't had any preview problems using SSI because this is an ASP site and I had to create a separate preview option to view the files in Inetpub anyway.

Fortunately, the sites I've built have all been fairly static. The CD interface will be used to keep the content of these few pages updated, rather than building many new pages, much less moving them about.

But I'll definitely give magic names a try for any site that is more dynamic in its page creation activity.

Carmen Carter
Monday, June 30, 2003

Cool.. By preview I meant "as you're designing" it's hard to keep track of the images if you make them absolute URL's, it's just one extra layer between you and the design.

www.marktaw.com
Monday, June 30, 2003

I always thought that the Magic names idea should be server based, so you would like to "site.com/link.cgi?About" and it would jump to the About.html page.

You can see it at Wiki (http://wiki.org/wiki.cgi?WelcomeVisitors), and it's extremely easy to create links (yo might not agree with the way they do it, see http://c2.com/cgi/wiki?JoinCapitalizedWords, but it's just easy).

When saying server based, I meant anything like ASP, PHP, PERL, and even client side javascript.

Bobb
Friday, July 04, 2003

*  Recent Topics

*  Fog Creek Home