July 15th, 1999, 12:41 PM
Is there a way to create many pages dynamically... say using a template? I've over 110 html pages with the same format and I'm sick and tired of creating new pages, updating old ones, with content and links. I've access to linux and unix, php, perl, and java...
July 17th, 1999, 05:48 PM
Well, perl and php3 are ideally suited to your task, but it depends on how far/fast/advanced you want to go. You can use a database to generate your pages, flat-file or SQL. I've successfully used dbMan - gossamer-threads.com/scripts/dbman by Gossamer Threads to create quite a large catalogue of products, which is basically what you're looking for, using flat-file databases (a MySQL version is available aswell, although it's quite expensive) and a program that's pretty easy to work with when you get the hang of it.
And you can do the exact same thing with php3, and probably better, because php3 integrates very well with SQL databases. It takes some time, but it's worth it.
There are a few drawbacks though, which can be got around, but take time and experience to get the hang of. For a start, if you use the one template for all of your pages, they're not going to be indexable by the search engines, because there'll be a query string on the href tag, like this:
But you can get around that with webserver trickery, for example using the mod_rewrite module, which means you can rewrite anything under, for example, /articles to be dealt with by the one page/app. I've done this with Perl, not with php3, but I know it's possible with both.
From experience, I would suggest you start with Perl and dbMan, and work with that first to give you experience with dealing with databases. Then start working with php3 and MySQL and get the hang of that, and then figure out the mod_rewrite mappings when you're done, and you'll just have to modify the resultant scripts a little to get that to work.
Of course, if you're comfortable with Perl or PHP3, you can just skip all of that and start at the end!
It may seem like a lot of work now, but the experience is invaluable if you work on the web a lot. I've just started working with MySQL and php3, after a lot of playing with Perl. This is my second time approaching it, and I can tell you now, it beats the hell out of anything else, and makes it weasy-peasy to automate nearly everything on a site. Sod ASP and microflot, this is the way to go.
When Zend comes out, I'll probably turn into a total net freak!
[This message has been edited by dahamsta (edited 07-17-99).]
July 22nd, 1999, 12:24 PM
Notwithstanding Dahamsta's reply, I have a simpler, although not as robust and more basic, answer.
I have implemented smaller sites (<1000 pages) simply using SSI and 4 templates (along with content).
All you need is ...
1. A format to stick with. I have used .txt as an extension for content pages, a standard header, sidebar and footer.
2. A script that reads the directory and generates a .shtml file with the necessary html tags for each .txt file, using a VIRTUAL INCLUDE pointing the .txt file. Stick the header, side bar, content and footer into a table. I usually make the sidebar the links bar. The sidebar gets generated from a META TAG from the content pages that you want links to.
3. Run the script.
February 8th, 2000, 08:01 AM
i want to use a template as well:
only with asp instead of php3
i can't seem to find a way to assess includes containing script dynamically, with either asp or playn (d)HTML...
can you help me?
April 14th, 2000, 11:53 AM
I know this is a long shot since you posted to this question awhile ago,
but could you let me know how exactly you use the META TAGs? I was
thinking you defined your own meta tag with a bunch of links in it
related to the "content.txt" page and then did a virtual include on
those through your script.
I need to publish a load of text documents and was hoping to do it with PHP. I know Project Midgard (http://www.midgard-project.org/) is probably too complicated for me, and I only use PHP for Virtual Includes and because a friend wrote some really cool navigational tools in PHP.
BTW, supposing your "content.txt" file contains "&" symbols for example,
what do you use to parse the .txt file to change "&" to "&"?
Would you consider e-mailing me a copy of your php script?