marți, iunie 13, 2006

Conditional Formatting FrontPage Memory Woes Solved

My previous post was complaining that memory was taxed to the max when the page you are editing in FrontPage has lots of conditional formatting. And by 'lots' I mean, about 40 or so (doesn't sound like much, does it?).

Anyway, I have abandoned the use of conditional formatting when I have to display an image, as exampled in my previous post. (Can't find it? Search for 'Nuclear' on my blog to get to it.)

This is how to avoid it:

For each status, have an image. One image for each status, each image the same size (otherwise the layout of your page might jump around a bit, I dunno, maybe that is what you want).

For me, I am using the issues list, and if we go by defaults (who does THAT anyway?), we see that there are 'Active', 'Resolved', and 'Closed' statuses for issues, and I have one image for each status:

  • CFActivebig.gif
  • CFResolvedbig.gif
  • CFClosedbig.gif
Note that the status name MUST appear in the image name, and the image names must conform to some standard naming convention that you can just make up. For me, I am using CF[status]big.gif as my naming convention because CF means that this is a conditional formatting image, and big means that it is the big image. (I plan on creating another view with tiny images representing each status as well, so I put the size into the naming convention.) My active image is a 100px wide by 20px high red image, Resolved is yellow, and closed is green. The images are just colored 100px by 20px rectangles.
  1. Open your view in FrontPage.
  2. Convert the view to XSLT Data View.
  3. Place the 'status' field where you want to display the image.
  4. Right-click one of the status names and choose 'Format Item As...', then choose 'Picture'.
  5. You will get a broken image, that's ok.
  6. Type 'ddd' next to the image (so that you can find the code that renders it).
  7. Go into code view.
  8. Type [ctrl]+F and search for 'ddd'.
  9. Change src="{@Status}" to src="CF{@Status}big.gif".
  10. Delete 'ddd' appearing just after the img tag.
  11. Upload your images to the list directory (or put them into the images directory, and map like this - Change src="{@Status}" to src="../../images/CF{@Status}big.gif".
You can now use this new-found knowledge to create your own, very complex conditional formatting projects without crashing your computer. And, on top of that, it is much easier to maintain. Think about things like what would happen if later in your project you wanted to put pictures of people who are users of the site, or picture of the person that the issue was assigned to, or all of the above in the same view.

Niciun comentariu:

Despre mine

Timi-Ostravia, Republic of Czedvia, Bulgaria
I make web applications. The tools I use are many and far between. I have been maining to learn Ruby and Python, and Perl. These tools are all like Lego to me. They can all be make to build things and have their strengths and weakest.