Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Dynamic Code executed at time of HTML generation?

Hey,
  Just started playing with the demo edition of CD yesterday, and I am absolutely blown away. Amazing! I've used many CMS' for various sites, but for the market you're looking at this is huge!
  My question is this. I have a server where I can't run ASP or any 'real' scripting language, but I want to do a 'product display page' per folder that has 4 iconic pictures across columns and as many rows as required. In scripted form, I could do a simple count to determine if the current article is the fourth one to be processed, add a close & open of table row HTML, reset my counter and continue processing.
  But, like I said, don't have scripting. Is there some CD script that can be executed at the time the HTML is parsed to do something equivelent to this?

Thanks,
J

Jamie O
Friday, December 07, 2001

Don't use tables -- use CSS:

<div style="float:left;width:100"><p>This is one item.</p></div>

<div style="float:left;width:100"><p>This is the next item.</p></div>

You will want to play with the borders, margins, etc. of the divs, but this will accomplish what you want.

Joel Spolsky
Friday, December 07, 2001

Food for thought:

I tried this once. I re-wrote my site using pure HTML4 and CSS, mostly as a learning tool in both. I made sure to lay out the document using the proper flow, so I put my nav bar at the bottom of the document and then used CSS to move it into the proper location on the screen. I also used measurements based on char sizes in the hope that if the user changed their font defaults everything would re-flow.

Well it doesn't work. Not a single person who tried the site could see it properly. The whole "graceful degredation" was a joke. Netscape failed utterly with items laying on top of each other so you couldn't read the articles OR use the navigation system. Different versions of IE did different things, not as bad as Nav but I still had similar unusable results in some cases.

In the end I concluded that CSS is fine for minor styling "overrides", but basically unusable for layout. I guess I should have suspected this when you consider the evolution of CSS.

One of the major problems is that the CSS positioning system is based on measures relative to your parent. What you really want to do is position next to your peers - put this nav bar beside the body text, or put this sidebar next to that paragraph. But that's not what happens, instead you have to make an invisible parent and then position both according to it. In the sidebar example, it means wrapping the para in a div and positioning both inside that - thereby completely violating the whole idea of flow-vs-presentation that CSS was supposed to help with! It also rarely worked, you had to go hunting down all the little things that were adding whitespace in weird places, and of course changing that ruined something else.

The other problem - and this seemed killer - was that the positioning system and the measurements based on font sizes seem to have a very serious feature interaction. If you do the "right thing" and use EM's and such for the measures, when the user does change their font size the entire system goes down the tubes. Again that's because there's no peer-peer measurements so as the font size increased everything got bigger and they ended up overlapping or wrapping in bad ways.

To put this in perspective, when the same site was laid out using tables, everything worked perfectly - even when the font size was changed!

IMHO I think CSS positioning will never work.

Maury Markowitz
Saturday, December 08, 2001

It did. For my simplistic case atleast...I made a div 143 pixels wide, with an exactly sized table within to do my internal alignment.<br>

Now one of the few remaining challenges of site migration into the CD paradigm (yes, today is buzzword day) is about having sub-navigation. As I understand it there is currently only one useful 'workaround solutions'
-Create a template within each folder that has the magicnames of the index page of each parent folder within it (in my case as a footer to the different product groupings and subgroupings).

Any chance we can get some info on what will be coming in the next version in the meantime? And a timeline on that?

Jamie O
Monday, December 10, 2001

I know everybody is excited to see CityDesk 2.0 :) but don't get ahead of yourselves. We haven't even started writing specs and a schedule for 2.0. In order to do the most important improvements and features that we have on our list, it will probably be shipping around September.

Joel Spolsky
Monday, December 10, 2001

*  Recent Topics

*  Fog Creek Home