You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Joachim Zobel <jz...@heute-morgen.de> on 2005/12/26 14:17:00 UTC
Filtering and Separation of Presentation Layer
Hi.
I think it makes sense to use Apache filtering to seperate the
presentation layer. The idea is to have an application layer that
outputs xml and a template engine attached by filtering that merges the
xml into html pages.
What is already there? Are there any template engines that can be
attached through filtering? Is there any spec. for an interface xml?
What are the cons of this approach?
Thx,
Joachim
Re: Filtering and Separation of Presentation Layer
Posted by Tom Schindl <to...@gmx.at>.
Joachim Zobel wrote:
>Hi.
>
>I think it makes sense to use Apache filtering to seperate the
>presentation layer. The idea is to have an application layer that
>outputs xml and a template engine attached by filtering that merges the
>xml into html pages.
>
>What is already there? Are there any template engines that can be
>attached through filtering? Is there any spec. for an interface xml?
>What are the cons of this approach?
>
>Thx,
>Joachim
>
>
>
>
>
Hi,
yes. I've written a port of AxKit for mod_perl2.
It has the following possibilities:
- (XSLT/Perl)Filter-Chain as an output filter
- Caching System based on various informations
Read more about it on AxKit-Dev-Maillinglist:
http://www.mail-archive.com/axkit-dev@xml.apache.org/msg01295.html
You can get the latest snapshot which is a little bit old here
http://www.bestsolution.at/documents/TomKit-0.01-1.tar.bz2
but should work, I've polished things in the last
days and will release it soon to CPAN.
Tom
Re: Filtering and Separation of Presentation Layer
Posted by Jonathan Vanasco <jo...@2xlp.com>.
On Dec 26, 2005, at 11:50 AM, Jeff wrote:
> I have been wondering recently about separation of presentation and
> data in the context of AJAX - whilst keeping the presentation still
> server-side. Anyone doing anything interesting in this space with
> mod_perl?
I've been working on an AJAX heavy site thats nearing completion for
a while now (so long, AJAX didn't exist when i started it. i called
it xmlhttprequest, and people said i was stupid).
i just run all of the data handling stuff from a /service/ directory
and offer multpiple ways to access it
?f(ormat)=json - JSON serialized objects
?f=xml - XML data structures
?f=xhtml - XHTML chunks that are used to entirely replace sections
of a page
the service modules are basically mirrors of page view modules --
except they only return a dataobject or error codes. since
everything on my project is oop, there's little actual code on the
page generation
I tried this project in a bunch of languages before setting on
mod_perl - php, python, rails -- i've actually found mod_perl to be
the easist and most straightforward way to do anything 'ajax' related.
it doesn't do the automagic js generation like some rails things do,
but I dislike a lot of that code.
> I think a server presentation later/filter, has to be preferred to
> complex client-side Javascript rendering engines? Javascript is a
> PITA to code and debug, and there are too many buggy versions out
> there.
Just use MochiKit ( http://www.mochikit.org ). aside from plugging a
friend's project, its f*ing amazing and REALLY simplifies and cuts
down JS coding (and debugging with its built in error logging).
The one issue with it though, is that the whitespace stripped version
is 70k ! - you can use a script inside the SVN trunk to make a
custom stripped version that only has certain elements -- I just use
Base and Async which make up 25k , to handle all of my data fetching/
parsing
On Dec 26, 2005, at 1:43 PM, Joachim Zobel wrote:
> One thing I have in mind is that this way it should be easy to move
> stuff between client and server. I have a TAL implementation in
> Javascript (http://www.heute-morgen.de/test/domtal.html -
> attention, no
> serious testing yet, no xml usage either) and I would like to put
> Petal
> into the filtering presentation layer.
Check out all of the above in this:
http://mochikit.org/examples/ajax_tables/index.html
Re: Filtering and Separation of Presentation Layer
Posted by Boysenberry Payne <bo...@humaniteque.com>.
I use something similar to this with mod_perl to flash using xml.
Flash then uses xml in a template fashion. Our templates are
highly configurable this way.
In the near future we will be doing it as mod_perl to ajax.
Unfortunately we haven't decided on how we want to make
our code public yet. Maybe in the near future...
When we have it doing ajax output, the template mechanisms
will become a lot more visible via javascript.
The nice thing about doing this way is off loading some of the
processing onto the client.
Boysenberry
boysenberrys.com | habitatlife.com | selfgnosis.com
On Dec 26, 2005, at 10:26 AM, Frank Wiles wrote:
> On Mon, 26 Dec 2005 14:17:00 +0100
> Joachim Zobel <jz...@heute-morgen.de> wrote:
>
>> I think it makes sense to use Apache filtering to seperate the
>> presentation layer. The idea is to have an application layer that
>> outputs xml and a template engine attached by filtering that merges
>> the xml into html pages.
>>
>> What is already there? Are there any template engines that can be
>> attached through filtering? Is there any spec. for an interface xml?
>> What are the cons of this approach?
>
> Separating your application like that is a great idea, most large
> applications do this type of separation inside of the app itself.
> While I haven't heard of anyone doing this in practice, I have at
> times thought about it.
>
> It would be fairly trivial to write a filter that takes XML input
> and rework it so that it can be passed into a templating engine like
> Template Toolkit.
>
> The only real drawback is that you've got the extra encode/decode
> cycle going on. Assuming you gather your data into some complex
> data structure, convert it to XML and then output it. You then
> have to convert the XML back into a perl data structure and then
> pass it to the template engine. This could cause significant
> performance problems depending on your hardware/traffic.
>
> If your app interfaces with a lot of various applications, uses
> REST/SOAP/XML-RPC, etc. extensively then it might be more worthwhile
> to do this, allowing you to completely separate your "internal"
> logic/data from the outside world.
>
> Another option entirely is using XSLT to do your transformation
> between XML and HTML. There is a plugin for Template Toolkit for
> this even.
>
> ---------------------------------
> Frank Wiles <fr...@wiles.org>
> http://www.wiles.org
> ---------------------------------
>
>
>
Re: Filtering and Separation of Presentation Layer
Posted by Joachim Zobel <jz...@heute-morgen.de>.
Am Montag, den 26.12.2005, 16:50 +0000 schrieb Jeff:
> I have been wondering recently about separation of presentation and data
> in the context of AJAX - whilst keeping the presentation still
> server-side. Anyone doing anything interesting in this space with mod_perl?
One thing I have in mind is that this way it should be easy to move
stuff between client and server. I have a TAL implementation in
Javascript (http://www.heute-morgen.de/test/domtal.html - attention, no
serious testing yet, no xml usage either) and I would like to put Petal
into the filtering presentation layer.
Sincerely,
Joachim
Re: Filtering and Separation of Presentation Layer
Posted by Jeff <mo...@aquabolt.com>.
-------- Original Message --------
From: Frank Wiles <fr...@wiles.org>
To: jzobel@heute-morgen.de
Cc: modperl@perl.apache.org
Subject: Re:Filtering and Separation of Presentation Layer
Date: Mon Dec 26 2005 16:26:21
> On Mon, 26 Dec 2005 14:17:00 +0100
> Joachim Zobel <jz...@heute-morgen.de> wrote:
>
>> I think it makes sense to use Apache filtering to seperate the
>> presentation layer. The idea is to have an application layer that
>> outputs xml and a template engine attached by filtering that merges
>> the xml into html pages.
>>
>> What is already there? Are there any template engines that can be
>> attached through filtering? Is there any spec. for an interface xml?
>> What are the cons of this approach?
>
> Separating your application like that is a great idea, most large
> applications do this type of separation inside of the app itself.
> While I haven't heard of anyone doing this in practice, I have at
> times thought about it.
>
I have been wondering recently about separation of presentation and data
in the context of AJAX - whilst keeping the presentation still
server-side. Anyone doing anything interesting in this space with mod_perl?
Our current approach is as Frank describes - two layers within the
server application (data generation and presentation), rather than the
filter idea floated by Joachim.
I think a server presentation later/filter, has to be preferred to
complex client-side Javascript rendering engines? Javascript is a PITA
to code and debug, and there are too many buggy versions out there.
Thoughts?
Regards,
Jeff
Re: Filtering and Separation of Presentation Layer
Posted by Frank Wiles <fr...@wiles.org>.
On Mon, 26 Dec 2005 14:17:00 +0100
Joachim Zobel <jz...@heute-morgen.de> wrote:
> I think it makes sense to use Apache filtering to seperate the
> presentation layer. The idea is to have an application layer that
> outputs xml and a template engine attached by filtering that merges
> the xml into html pages.
>
> What is already there? Are there any template engines that can be
> attached through filtering? Is there any spec. for an interface xml?
> What are the cons of this approach?
Separating your application like that is a great idea, most large
applications do this type of separation inside of the app itself.
While I haven't heard of anyone doing this in practice, I have at
times thought about it.
It would be fairly trivial to write a filter that takes XML input
and rework it so that it can be passed into a templating engine like
Template Toolkit.
The only real drawback is that you've got the extra encode/decode
cycle going on. Assuming you gather your data into some complex
data structure, convert it to XML and then output it. You then
have to convert the XML back into a perl data structure and then
pass it to the template engine. This could cause significant
performance problems depending on your hardware/traffic.
If your app interfaces with a lot of various applications, uses
REST/SOAP/XML-RPC, etc. extensively then it might be more worthwhile
to do this, allowing you to completely separate your "internal"
logic/data from the outside world.
Another option entirely is using XSLT to do your transformation
between XML and HTML. There is a plugin for Template Toolkit for
this even.
---------------------------------
Frank Wiles <fr...@wiles.org>
http://www.wiles.org
---------------------------------