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

Re: [cgiapp] directory structure and static pages


Another good question for best practices. With hierarchical organizing schemes such as directories there will always be many different ways to skin this cat. I have been avoiding this problem though I know that I will soon have to come to terms with it. If you want to use a template to generate your static pages as well, I would recommend using a "make" file and store all of your html files in a source directory. A makefile is used by programmers to build object files and executables and allows you to state the dependencies between files. This way when you change a single template file, just the necessary actions are taken to generate the static files that depend on it, as opposed to rebuilding everything. You can run the make file to generate the static pages using html template or perhaps some inline perl commands use regular expressions and write them out to your htdocs directory.

For templates used in generating dynamic pages I move them to a template directory. Depending no the complexity of the page I will often process the page doing things like adding error code to forms and tweeking the paths to the resources.

Here is my recommended directory layout for larger sites

webapp/src - basically everything in htdocs
webapp/htdocs - includes some additional html pages generated by make file
webapp/cgi-bin - instance sripts (.cgi) and specialized .pm files
webapp/lib - general libraries you have written (.pm)
webapp/template - html based template files used by HTMLTemplate
webapp/msg - text based email templates used by HTMLTemplate

This is my current approach to this problem although I haven't implemented the src directory yet, I have been using everything else including the make file. I honestly do not know if how well the src directory will work. There will be subdirectories such as the src/images directory that will need to be copied over to htdocs. This can be implemented in the make file also.

regards,

-john


On Thursday, September 4, 2003, at 07:01 AM, 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?

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?

much thanks for any advice and I think the discussions on this list are invaluable.

---------------------------------------------------------------------
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



---------------------------------------------------------------------
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.