Templating system

2000-07-27 Thread Darko Krizic

I want to write a new application using mod_perl but this time I want to
completely divide the code from the HTML. Therefore I am seeking for a
powerfull and fast templating system.

Newly I did something with Enhydra (Java Servlets) and they have a pretty
neat templating system: They use standard HTML and one uses the "id"
attribute in HTML tags to access them and manipulate values/contents. For
example:

table id="results"
tr id="resultheader"
thName/th
thCount/th
/tr
tr id="singlerow
td id="row_name"example name/td
td id="row_count"example count/td
/tr
/table

The program now can repeat the tr "singlerow" for each table row and insert
it under the tr "resultheader". The values can be inserted into the tds
"row_name" and "row_count". The main advantage is: The designer can generate
HTML pages that can be viewed with a standard browser.

Does anybody know something similar for Perl?

...darko





RE: Templating system

2000-07-27 Thread Darko Krizic

  Newly I did something with Enhydra (Java Servlets) and they 
 have a pretty
  neat templating system: They use standard HTML and one uses the "id"
  attribute in HTML tags to access them and manipulate 
 values/contents.
  [...]
  Does anybody know something similar for Perl?
 
 No, but I was thinking of incorporating enhydra's XMLC technology into
 AxKit. I'm not sure its a better method of working than XSLT or
 XPathScript though, which allows you to be future looking (always
 XML). But it could be kinda neat to do. Should be almost trivial with
 HTML::Parser to generate perl out of that. Providing of 
 course they don't
 have some stupid patent on it (doubtful since its GPL'd).
 
 Can you wait, or do you need something now?

As you know projects must be finished until yesterday. It would be a dream
if we could share the templates between Enhydra and Perl. The only problem I
see here is the performance. Enhydra compiles the java and the HTML pages
and creates methods and a DOM model. Doing this on the fly (for mod_perl)
would be a big drawback in performance. Maybe there should be some kind of
precompiling.

How long do you think would this last? I could wait for about 3 hours or so
;-)

The problem with many templating systems is the fact that they invent a new
language like "td$variable/td" which is usually not displayable in the
Browser so that the designer and the programmer must work tightly.

What other templating systems do exists that are usefull?

...darko



RE: Templating system

2000-07-27 Thread Darko Krizic

  The program now can repeat the tr "singlerow" for each 
 table row and insert
  it under the tr "resultheader". The values can be inserted 
 into the tds
  "row_name" and "row_count". The main advantage is: The 
 designer can generate
  HTML pages that can be viewed with a standard browser.
  
  Does anybody know something similar for Perl?
 
 Hmmm. Depends what you mean. I think in your context, the Template
 Toolkit has many more obvious tags that will litter themselves in the
 HTML. However, using includes and macros effectively you reduce the
 amount of cruft in the code.

What is the Template Toolkit?

...darko



RE: Templating system

2000-07-27 Thread Darko Krizic

  How long do you think would this last? I could wait for 
 about 3 hours or so
  ;-)
 
 Well... longer than that. But even if I wrote something this 
 afternoon -
 you still wouldn't learn it very quickly.

No stress here please. If you do something then send it to me and I will
take a closer look at it.

  The problem with many templating systems is the fact that 
 they invent a new
  language like "td$variable/td" which is usually not 
 displayable in the
  Browser so that the designer and the programmer must work tightly.
 
 Thats a problem with _all_ template systems, including XMLC. 
 With XMLC's
 method you still have problems with bits that get conditionally
 included. Sure, looping rows of tables look good, but wait 
 until you start
 using XMLC a lot. Then you'll find the flaws.

As I said: One problem with enhydra is that the id "x" is a tr.

 Better to start with a standard that you can build on, like 
 XSLT, IMHO.

Sure.

  What other templating systems do exists that are usefull?
 
 Thats a huge question, here's a few:
 
 EmbPerl- mixing of HTML and logic
 Template Toolkit   - will take a look at it right now
 Apache::ASP- nice (session management), but still mixing
 HTML::Template - own language
 XSLT
 XPathScript (part of AxKit, which can also do XSLT) - will take a look at
AxKit
 Mason  - AFAIK mixing

Comments start with -

...darko



RE: Templating system

2000-07-27 Thread Darko Krizic

   Apache::ASP- nice (session management), but still mixing

 I saw your note about Apache::ASP mixing... 
 with Apache::ASP a lead site engineer can define custom tags
 with XMLSubsMatch that will make XML tags execute
 as perl subs, check out: http://www.nodeworks.com/asp/xml.html

 Apache::ASP thus allows you to create your own set of 
 tags to lose the code mixing which is the bane of many
 a web designer.

Sorry for my note. The last version of Apache::ASP I used was about 1.0 I
think. I don't know the new features of Apache::ASP.

I like Apache::ASP, it is implemented well and is the best tool for writing
some code that requires lots of interaction (forms and so), mainly because
of the transparent Session Management. I used to write ASP under IIS with VB
so I like to concept of Apache::ASP (especially because there is Perl
inside).

...darko



RE: Templating System

2000-07-27 Thread Darko Krizic

 Darko Krizic [EMAIL PROTECTED] wrote:
  ... 
  table id="results"
tr id="resultheader"
thName/th
thCount/th
/tr
tr id="singlerow
td id="row_name"example name/td
td id="row_count"example count/td
/tr
  /table
  ...
  The problem with many templating systems is the fact that 
 they invent a new
  language like "td$variable/td" which is usually not 
 displayable in the
  Browser so that the designer and the programmer must work tightly.
 
 The designer has to learn 'id="row_name"' in one case, and 
 $row_name in
 the other.  I'd say that the need to work tightly with the 
 programmer is
 pretty much the same: you have to agree on a syntax for gaps that code
 can fill, and on the names of the individual gaps.

There is one big difference in the enhydra approach: The templates are
standard HTML, because the id tag is part of the HTML standard. The designer
can create the whole site and make a dry test, because all links even work.
The tags (with ids) can contain valid values.

...darko



How to get VirtualHostUser abc/VirtualHost

2000-07-11 Thread Darko Krizic

I have a PerlTransHandler and I have a bunch of virtual hosts. Each virtual
host looks like this

VirtualHost abc.com
User abc
Group abcs
/VirtualHost

(How) can I access the User and Group definitions in the VirtualHost (which
are intended for suexec)? Is this feature missing in mod_perl 1.24? The
eagle book only knows on mod_perl 1.19.

...darko