[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] Re: directory structure and static pages


In article <suppressed>, Andy Taylor wrote:
> I'm getting ready to start a fairly large project using CGI::App and I was just wondering how some of the more experienced/knowledgeable people on this list handle some issues.
> 
> 1. if you are doing a project with a superclass and several modules,
> where do you put your templates and how do you organize them? For
> instance, if /home/ataylor is my home dir, do most people do something
> like /home/ataylor/project/modules and /home/ataylor/project/templates
> and put all the templates in one big directory?

On my projects, the templates tend to share the same Dreamweaver-based
templates that other static pages on the project do. For this reason,
the templates need to be web-visible space. We put them 

 /home/proj/www/Templates

... which is a directory that Dreamweaver creates for it's on use
anyway. On a live site, this directory could be password protected if
needed.

Each sub project has it's own template in:

 /home/proj/www/Templates/subproj

with only global templates in the root directory. 

> 2. for a large project, not all of the pages have to be dynamic
> obviously. How do people deal with static pages that you want to still
> share the look of your dynamic pages that you are using HTML::Template
> for? I was considering creating a commandline tool to generate the
> static pages from the HTML::Templates or creating a module just for
> serving static pages (not that they would be static anymore) and
> wrapping the header and footer, setting the title, etc. but each of
> these have downsides. How do the experts do it?

As above, our solution is to cooperate with Dreamweaver. There were a
couple important snags to overcome. One was to make relative URLS work
correctly, because DW will make the links work relative to the location
of the file in the "Templates" directory, not the CGI script that calls
it, using "PATH_INFO" to pass the run mode makes things works. So we use
an overloaded load_tmpl() function that creates an HTML::Template tag
that produces a "<base href>" tag that points to the right place in the
/Templates directory and makes all the links work correctly. Since the
static pages will just ignore this tag, it produces the correct effect
for both static and dynamic pages.

The other sticking point with DW is that for some H::T tags that are
otherwise invalidly nested inside HTML tag, it re-writes the tag syntax
to be URL-escaped, breaking the CGI scripts that use them. For a long
time I tried to battle DW to prevent it from doing this. Ultimately, 
I've written an HTML::Template filter that silently transforms the
mangled tags back to the correct syntax. I think I posted that to the
H::T list.

Brian Paulson took a different route to work with Dreamweaver. He wrote
a Perl module that allow you to use a DW template as a valid
HTML::Template:

http://search.cpan.org/author/BPAULSEN/HTML-Template-Filter-Dreamweaver/

It looks neat, but I haven't tried it yet myself.


	Mark

--
http://mark.stosberg.com/ 


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.