Yes, by "javascript" I mean Prototype API.

A simplified use case is as follows:

A user has selected X pieces of furniture.  On a single page, they are
shown a list of the furniture items with specific info about each
piece.  For example, name, dimensions, manufacture, list of parts
etc.  Much of this info wouldn't be shown by default but is
expandable.  The user can delete furniture items or add new ones. When
they add a new one it is immediately added to the page.  In order to
add it to the page (without reloading the whole page), I either need
to dynamically build the new furniture item block using javascript or
use AJAX, build the block server-side and then add it to the page.

At first glance, doing it server side might seem easier but I am
playing with moving as much of the presentation code client-side as
possible.  So, the server-side job would just be to build a js array
with name, dimensions, manufacture, list of parts, etc for each piece
of furniture and use javascript to build the whole page.

I hope that is clear.


On Aug 18, 8:40 am, "T.J. Crowder" <[email protected]> wrote:
> Hi,
>
> I don't think I'm clear on what the use case is and why you're
> converting it from HTML to "JavaScript" (by which I take it you mean
> DOM API or Prototype API or Builder code).  What's the goal of the
> conversion?
> --
> T.J. Crowder
> tj / crowder software / com
> Independent Software Engineer, consulting services available
>
> On Aug 18, 4:28 pm, drewB <[email protected]> wrote:
>
> > Interesting suggestion.  Unfortunately, the content is more dynamic
> > them just text replacements.  For example, there is a list of varying
> > length.  Also just using template for 200 lines of text doesn't seem
> > very "tidy" to me.
>
> > On Aug 18, 3:19 am, Richard Quadling <[email protected]> wrote:
>
> > > 2009/8/18 drewB <[email protected]>:
>
> > > > I have 200 lines of an HTML snippet that I plan to convert to
> > > > javascript using Prototypes Elements.  Instead of doing this by hand,
> > > > I figure I could write some code that would take any block of HTML and
> > > > convert it to javascript.  Then it occurs to me that I couldn't be the
> > > > first one to think of this.  Does anyone have some code that will do
> > > > this or know of a tool?  I am looking for something like
> > > >http://www.smelzo.it/html2js/butusingPrototype Elements instead of
> > > > basic javascript (something that uses Builder would be ok also).
>
> > > > Thanks!
>
> > > Once you've converted it to JS, what do you intend to do with it?
>
> > > If you are going to re-use it (say with different content), then maybe
> > > the Template mechanism within Prototype [1] would be what you are
> > > looking for.
>
> > > Richard.
>
> > > [1]http://prototypejs.org/api/template
>
> > > --
> > > -----
> > > Richard Quadling
> > > "Standing on the shoulders of some very clever giants!"
> > > EE :http://www.experts-exchange.com/M_248814.html
> > > Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731
> > > ZOPA :http://uk.zopa.com/member/RQuadling
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to