Reuse your templates

15 views
Skip to first unread message

Mic (BeeBole)

unread,
Aug 7, 2008, 4:49:11 AM8/7/08
to PURE Unobtrusive Rendering Engine for HTML
Stephan Schmidt posted on our blog the following comment:

Looks very good. One issue I see is reuse of components. For example
you might want a login box on every page, which changes state when
being logged in.
Can solve Pure this requirement withouth cut&paste the box into every
page?
Peace
-stephan
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

@Stephan, #12
As a login screen is a fairly static HTML you can apply the following
procedure:

* Place the HTML for the login screen in a page while you develop
* Set the directives to make it live
* Then compile it to a JS function (with $p.compile)
* collect this JS function, (with $p.getRuntime; See a "how to" at the
bottom of the page: http://www.beebole.com/pure/examples/docs/allExamples.html)
* copy&paste the JS functions into a file(.js) that is common to all
your pages (probably with your login logic too)
* Then call this JS function when needed. Note the browser will cache
this JS file

Mic (BeeBole)

unread,
Aug 7, 2008, 5:06:25 AM8/7/08
to PURE Unobtrusive Rendering Engine for HTML
Stephan asked from our blog:
Thanks for the reply.

Doesn’t sound very usable from a designer view point. And as far as I
see doesn’t allow for “push-button” release management, when a
developer has to modify all pages by hand for release. Or I don’t get
it yet

Peace
-stephan

Mic (BeeBole)

unread,
Aug 7, 2008, 5:19:21 AM8/7/08
to PURE Unobtrusive Rendering Engine for HTML
Open the page: http://www.beebole.com/pure/examples/docs/allExamples.html
You could see it as a way to organise all your HTMLs in one page.
If some changes are made, you compile them (as you can see at the
bottom of the page).
Copy the content of the textarea to the corresponding js file, save
it.
Then commit your change to your git/svn/...
So not a one push button, but 3.

If this way results to be painful(remember we are the first guinea
pigs of PURE), we'll probably come with a simpler way.
Altough the big difference for us, is we have a single HTML page for
the whole application.
If you think on a good way to handle this, please share.

Stephan.Schmidt

unread,
Aug 7, 2008, 5:32:13 AM8/7/08
to PURE Unobtrusive Rendering Engine for HTML
I thought about using AJAX to load (and cache) templates for
components

There is some discussion going on about one-page apps (GMail comes to
mind), versus many-page apps (most others). Following some discussions
people think the sweet spot might be 3-5 pages.

Most of the components can be used on one page, in the way you
describe, but some as a login page or a info box might see some reuuse
over several pages.

PURE is excellent to really divide developers and designers, something
PHP, JSP and most templating engines didn't succeed in (RIFE seems to
be one major exception). So I think PURE should optimize this use
case.

Peace
-stephan

Stephan.Schmidt

unread,
Aug 7, 2008, 5:52:00 AM8/7/08
to PURE Unobtrusive Rendering Engine for HTML
"As a login screen is a fairly static HTML"

Usually not.

The Login Screen displays a Name/Password/Button combination for
logged out users, and
You are ABC / Logout for logged in users.

Peace
-stephan

Mic (BeeBole)

unread,
Aug 7, 2008, 6:16:16 AM8/7/08
to PURE Unobtrusive Rendering Engine for HTML
Very nice! I've posted an enhancement ;)
http://code.google.com/p/pure/issues/detail?id=14

I'm a big fan of 1 page apps.
It was already our model in our previous work, while we were building
web apps on top of SAP.
May be I'm blind now, so I'm very interested to know what the "3-5
pages app" wins over the "1 page app".

Thanks,

On Aug 7, 11:32 am, "Stephan.Schmidt" <stephan.schm...@gmail.com>
wrote:

Stephan Schmidt

unread,
Aug 7, 2008, 7:14:45 AM8/7/08
to Pure-Unobtrusive...@googlegroups.com
For example, the start page of an application (e.g. LinkedIn) might be
different than the other pages, but still contain dynamic content. And
the layout/content so different from your main app page that it's
easier to have 2 pages than to make the main app page flexible enough.

Peace
-stephan

--
Stephan Schmidt :: ste...@reposita.org
Reposita Open Source - Monitor your software development
http://www.reposita.org
Blog at http://stephan.reposita.org - No signal. No noise.

Reply all
Reply to author
Forward
0 new messages