Re: Picking up .wo changes
Re: Picking up .wo changes
- Subject: Re: Picking up .wo changes
- From: Jonathan Rochkind <email@hidden>
- Date: Thu, 05 Jun 2003 11:46:07 -0500
At 09:23 AM 6/5/2003 +0200, Anders F Bjvrklund wrote:
Suppose I have to keep even more layout definitions outside the WO components,
to avoid having to deploy a new application for every little layout change ?
Perhaps fetch them from the database or read them from a file or something.
Well, it's actually easy enough for a particular component to NEVER cache
it's .html/.wod information. It's easy enough to make your component get
it's .wod/.html in the usual way, but never cache it. Just over-ride
template(), and your implementation can find the appropriate .wod/.html
files (not sure the right way to do this, but I know there is an easy one),
and then pass them to templateWithHTMLString and return the result. Now
you've got a component which behaves just the same as usual---but never
caches the WOElement object that results from combining the .html and .wod
files. Because the caching takes place in the default implementation of
template(), which does much the same thing we just discussed, but adds
caching to it.
So if you do this, every single time the page is accessed, the .wod and
.html files will be re-read, and re-parsed, to create the WOElement
object. So there's no good reason to do this, unless for some reason you
want some components that don't ever cache their WOElement objects. [If you
want NO components to cache their WOElements, it's easier just to turn this
off with the relevant flag]. More typically, you might want a component
which gets it's .html/.wod from a non-traditional place, or actually uses
different .html/.wod at different times depending on state, and that's why
you'd over-ride template(), and lose the caching (intentionally or not).
But what you're asking isn't to lose this caching entirely on a
component-by-component basis, or to make the component get it's .html/.wod
from a non-traditional place----what you're asking is to have the
WOElement-generation and the caching work as normally---but allow you to
invalidate cached WOElements at will. This is what you can't easily do,
because the cache system used by the default template() implementation is
not exposed at all.
If you could re-implement the cache system yourself, then you could use it
in your custom template() implementation, to get a caching system that
performed just like the existing one, but exposed enough API to allow you
to invalidate entries at will. I've never tried to do anything like this,
but it's this that Pierre says he has done, and he says it wasn't at all
easy, so there you go.
But you don't need to keep the .html/.wod in a non-standard place---and
don't gain anything by doing so. You can keep it in the standard place, but
over-ride template(), using templateWithHTMLString() in your
implementation, to avoid ever caching the parsed .html/.wod for that
component. Which is exactly what you'd get anyway if you kept the
.html/.wod in a non-standard place, like the db or something.
Then again, maybe this is the divine sign that I should rewrite it, and lose
the pesky .wod files forever and just integrate everything into the .html
files ?
I suppose.... but I'm not seeing what you'd get from this. Whether the
information to create the dynamic web page is in one file (.html) or two
(.html/.wod), that information will still need to be parsed to create the
actual objects that will generate the web page. And the results of that
parsing either will be cached, or they won't. If they are cached, you'll
either be using the existing component definition cache (in which case you
have no way to invalidate entries) or you'll be writing your own (which
Pierre tells us is no fun). Getting things to work without a .wod is
going to be no fun (unless your page is just straight html with no dynamic
content or sub-components, in which case it's straight HTML already!), and
I can't see how it would get you anything you are interested in anyhow.
--Jonathan
So that one can edit the .wo components in modern webpage editing tools, I
mean...
Like these guys do ? http://www.cluster9.com/examples/index_e.html
(C9WOTemplate)
--anders
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.