[pmwiki-users] ajax-like skins (was: new recipe ShowHide)

Patrick R. Michaud pmichaud at pobox.com
Thu Mar 2 21:05:38 CST 2006

On Fri, Mar 03, 2006 at 01:34:35PM +1300, Robin Sheat wrote:
> So you 
> could hit 'preview', it sends the current text, and the server renders 
> it, sends it back, and that is put in the preview section. All without a 
> full page reload.

I'm not sure I completely see or understand the claimed advantage here.  

Normally we want to avoid a 'full page reload' on the web because it's 
considered expensive (bandwidth, time) to download a full page 
when we just want to update a small component of the page, such as
a sidebar or small callout component.

But in this particular scenario, we're proposing to use ajax
to return the *main* component of the page -- i.e., the preview. 
Not only that, but the preview is the component that takes 
--by far-- the bulk of the time to render.  So it doesn't seem 
that ajax will provide much in the way of speed improvement to 
the author -- there's still essentially the same overhead involved:
establish the connection, issue the request, wait for PmWiki to 
render the page contents, retrieve the results, and display them.
I.e., the difference in performance between retrieving just the 
preview and doing a "full page reload" is likely to be
very small.

It's true that for rendering the just the preview component
PmWiki won't have to render the skin or sidebar components, but
it must still load and process them, and they really take very little
time to render anyway.  

There is a potential "interface quality" improvement here, because
even if the overall performance is not truly any faster, it might
appear to be more seamless to authors simply because the page
components don't refresh, so that might be worthwhile.  But having
looked into it over the past couple of weeks I don't think we need
ajax to accomplish that -- javascript may be a simpler and cleaner 
overall solution.

Through some off-list discussions with others on the topic of improving
the preview capability, I'm thinking that the much better
approach may be to let ?action=browse accept markup text from a
POST request, instead of reading the page.  Then, we can use a short
javascript so that the preview button creates a new "preview" window and
populates it with the results of sending the current markup text
from the textarea to ?action=browse.

Or perhaps it's really the edit form that belongs in a separate window,
and pressing "Save" or "Preview" in the edit form causes the main window
to update with the latest text.


More information about the pmwiki-users mailing list