Reputation: 49
So basically I have this "gallery" page of mine which works by having a mysql database that stores the references and file names of the images i'm uploading. I also have "albums" where similarly categorized pictures are in there. My question is, I would like php to generate me an html file whenever I would like to have a new album (since this albums are just href's to another html page that contains the images). I know how to use fopen() and fwrite() but my problem is, how can I create a string that would be able to hold a WHOLE HTML DOCUMENT formatting? That doesn't require me to escape double quotes and such anymore?
Upvotes: 0
Views: 71
Reputation: 163272
What you really want is a templating engine, such as Smarty.
Next, you can write static HTML files to disk if you want... but consider outputting them dynamically. Use rewrite rules to point your galleries at a single PHP scripts that generates these. It tends to be more manageable.
(There are situations where static files can be useful... such as distributing to CDNs and what not. But I'm guessing that for your case, a dynamic page is sufficient.)
Upvotes: 2