Hello Masons,

I'm building a modest database-backed site that I expect will need to be
cloned, with minor adjustments to each clone, so I want to use a shared
library of Mason components that are called by a few site-specific files.

I can think of a few ways of structuring the site, and I'd appreciate your
recommendations on which one you'd choose, or if you'd do something
completely different.

The site is not complicated--4 or 5 major tasks that might each have a page
of their own if I weren't using autohandlers or shared components.

Option A: Build an 'index.html' page that calls the appropriate component
(e.g., 'do_A.comp.mas') depending on parameters in the request string or
form data. All site-specific content (stylesheet invocation, site header and
footer, etc.) is coded in index.html, and this is the only URL that's
exposed to the user.

==========
index.html
==========
<%init>
# validate form data, get database handle, etc.
my $component
if ( $form_data{do_A} ) {
   $component = '/shared/library/do_A';
} elsif ( $form_data{do_B} )
   $component = '/shared/library/do_B';
} else {
   $component = '/shared/library/do_default';
}
</%init>
<html>
<head>
<title>page title</title>
</head>
<body>
<& $component &>
</body>
</html>

=============
do_A.comp.mas
=============
<%init>
# task A processing
</%init>
<div id="task_A">
display task A stuff
</div>


Option B: Build a few task-specific pages (e.g., 'do_A.html', 'do_B.html')
that all inherit from 'autohandler', which contains the site-specific stuff.

=========
do_A.html
=========
<%init>
# validate form data, do other stuff for task A
</%init>
<div id="task_A">
<!-- stuff -->
</div>

===========
autohandler
===========
<%init>
# get database handle
</%init>
<html>
<head>
<title>page title</title>
</head>
<body>
% $m->call_next;
</body>
</html>


Option C: A hybrid of A and B. Build 'index.html', which inherits (a
database handle, for example) from 'autohandler', and which then calls an
appropriate component. I think this is less complicated than B, but I'm not
sure if it's better than A.


-- 
Michael R. Boudreau
Senior Publishing Technology Analyst
The University of Chicago Press
1427 E. 60th Street
Chicago, IL 60637
(773) 753-3298    fax: (773) 753-3383



------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to