Gossamer Forum
Home : General : Perl Programming :

Software to Build Site with database & Templates

Quote Reply
Software to Build Site with database & Templates
Does any body know of a program that allows you to build a website from templates with integration with a database?

I'll explain exactly what I want to do:

For my news section I want to be able to keep the main text of my articles in html (this is so that I can have hyperlinks) in a database, either mySQL or flatfile.

Then I create my templates for my different sections and put a tag/script/whatever I need to do to, so that my main body can be inserted as well as wherever else I want to put in such as header/footers with ssi's.

Then, I press build and I get my whole site built. This way I have static pages for indexing and faster user access then dynamically building all the content.

The program/cgi/perl script should run on Linux.

I am a complete beginner so anything should be explained using the KISS* system pretty please.

*keep it simple stupid Smile

Quote Reply
Re: Software to Build Site with database & Templates In reply to
Why not just create a generic page top and page bottom and plug them in with SSI. I've been doing exactly what you would like to do on my site for a couple years now. You can easily have different templates for if you like, just refer to it in the SSI command. So it would looks something like this:

<!--#include virtual="/page-top.html"-->

some contents here...

<!--#include virtual="/page-bottom.html"-->

Simple as that. You have to rename your "html" files to "shtml" but that shouldn't be a prob.

Hope that helps out.


------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: Software to Build Site with database & Templates In reply to
Using SSI is a great way to structure a site for quick updates. Utilizing structered directories related to month, day, year is helpful as well. As for searching there are plenty of free site indexing solutions to search your site.

However, I understand what you are asking. There are solutions out there that do what you want. Not to the high level of dophistication as Links, more link the NY Times site. I have been playing with Links to work in content delivery. it is slow going because of work, but when I get it done I will send it to Alex to look at. Hopefully at that point, others may be interested.

Thank you to Alex for a great script.
Quote Reply
Re: Software to Build Site with database & Templates In reply to
WOW!

That modification would be unreal.

Please e-mail me directly when you finish.

Quote Reply
Re: Software to Build Site with database & Templates In reply to
I'm working on another solution myself, which makes a site truly dynamic, indexable and gives it the ability to be changed across the board in a matter of minutes. However I'm not sure if it'll ever go on general release because I don't think there's the demand for it, particularly with the upsurge in NT server usage. Also, this solution is currently limited to Apache or equivalents.

That said, I'll give you a basic rundown, it might be a help in developing a system yourself.

The whole site, or areas of the site are controlled by one cgi script, however rather than feeding data into the script in the regular manner (i.e. by a URL-encoded string), the data is retrieved by the script using the REQUEST_URI environment variable. This is achieved by rewriting requests under a certain directory using the Apache module mod_rewrite, like this:

RewriteEngine on
RewriteRule ^sites/3.* /cgi/sites/3/index.cgi [T=application/x-httpd-cgi]

This tells the server to rewrite any request for anything under /sites/3 on the server to the file /cgi/sites/3/index.cgi, and marks this file as a cgi script.

The script then checks the REQUEST_URI to see where users (think they) are on the server, and delivers the appropriate content. The benefits of this system are that you can create navigation and location bars by simply stripping the REQUEST_URI and rebuilding it appropriately. At present, the system pulls content from files in a certain directory, using the REQUEST_URI as an identifier, for example, a request for /sites/3/dir1/dir2/ will be related to a file called dir1.dir2.dat in a common directory. But I will shortly be modifying it to pull the data from a flat-file database, which means other data could be included in a more organised fashion, i.e. Last Modified, Author, etc.

There are distinct advantages and disadvantages of a system like this. The no.1 advantage is that the main design of the site can be modified in a matter of minutes. For instance, changing the complete design of the site can be achieved by editing just one file; adding a new area and button on the navbar, by editing an associative array, or a flatfile database. And almost as important, because the search engines won't know that the returned content is from a cgi script, your pages get indexed correctly. Add to this the fact that you can change your META tags across the board in a moment, and with a little research, your site will be top of the rankings all the time.

The disadvantage can be speed. Because everything is delivered from one cgi script, this will put a little extra overhead on the server. However, I might also point out that using SSI to achieve a very basic version of the same effect will also add an overhead. With a little extra work, you could easily have the script create copies of itself and have mod_rewrite balance the load on them. However, when all is said and done, unless your site is very large, and/or uses a lot of bandwidth, there shouldn't be too much of a problem.

You can see a sample of this in action at http://iewebs.com/sites/3/ , however please note that this is an experimental install, there's very little content there (I think you can only get as far as http://iewebs.com/...gn/sites/corkcityfc/ . But it does demonstrate the dynamic ability of the set-up. Notice the buttons in the Global Navigation bar highlight themselves as you change area, and the JavaScript preloads only create the content needed for the page; the location hyperlinks each directory, and highlights the active one; and the Local Navigation contains only information pertinent to that area. All this is achived using a few arrays and associative arrays, and will later be controlled by installs of dbMan. An install of FileMan would complete the picture, meaning you wouldn't even have to FTP into the server to perform updates.

I hope all this helps give you a few ideas for your own site...

adam
Quote Reply
Re: Software to Build Site with database & Templates In reply to
Dudes & Dudettes,

Seek and ye shall find they say.

Well I found the answer to my question in an old archived article at WebMonkey.

There is a program call Frontier that uses a database to store all your elements text, html, styles, etc..

You then press build and voila, it builds your entire site which you then upload to your server.

Here is their home page:

http://frontier.userland.com/news/

and the trial versions can be downloaded at

http://www.userland.com/frontier/trial.html

I have not had the chance to use it to the max as I am pressed for time right now but I played with it and it seems really cool.
Quote Reply
Re: Software to Build Site with database & Templates In reply to
If you wanted client-side, you should have *asked* for client-side. You would've got an answer a lot earlier...

Harrumph!

adam
Quote Reply
Re: Software to Build Site with database & Templates In reply to
I did not care whether it was client or server side.

This one seems to be the closest in functionality to my original post.

Because the important issue was/is that the pages get built and are not built on the fly.

But I am sorry if I was not clearer in my original post Smile