blog
HOME · CREATIVE · WEB · TECH · BLOG

Tuesday, August 21st, 2007

How to work around bug in large 4D 2004 web templates

In general, 4D 2004's web templates are a wonderful thing and most of the time they work flawlessly, but like any technology they have a few bugs...

Lately I've seen pretty much the same problem with two different clients. In both cases the templates were relatively complex, about 28-29K in size, and generated using 4D's PROCESS HTML TAGS command (using BLObs). The problem does not appear on smaller, simpler templates, and I've seen other templates in the same size range and of equal or greater complexity that don't have any problems.

Essentially what appears to happen is 4D gets confused and starts generating errors and repeating portions of what it's already composed. One one case this happened consistently, in the other case it only happened sporatically.

Here's an example of what the output looks like when things go bad...

Example of 4D web template problem

As you can see, the image was repeated, followed by an 4D error message (which is logically invalid), and then the portion of the page following that was corrupted. When you look at the code of the page you'll see a large block of the HTML code repeated in the page around the area having problems.

The solution is relatively simple conceptually, but a bit of a pain to implement and do a degree it may require a little voodoo. Essentially what you have to do is break the template into smaller pieces. Process multiple templates with PROCESS HTML TAGS - first the children templates, and then combine them together using 4DHTMLVAR tags in the parent template. Its' worth noting that 4DHTMLVAR does support BLObs.

The voodoo aspect of it is that just splitting up the template into smaller pieces may not be sufficient. In at least one case I've seen perfectly good code that just won't work next to each other. Putting part of it back into the master template solved the problem. The moral of the story is that splitting things up is the solution, but you may need to do some tests to see what needs to be broken out from what...

And after doing that things should work (as you can see below)...

Example of 4D web template problem

Tags: ,
Categories: 4D, Web Application Development

Leave a Reply

HOME · CREATIVE · WEB · TECH · BLOG