I don't have any to offer you, meaning I'm no help.

But, you realize what you could be doing?

Each and every time 1 person requests a page, you'll be having PHP go to MySQL to retrieve the almost always the same page template(s). MySQL is fast, but you start piling on web traffic and queries for more useful information, you may end up stressing MySQL more than you need to.

A file system rocks at handling files. A database is great for handling data. You might think about storing your file not in the database but in the file system.

Also something to ponder: how will you get templates in and out of MySQL (when its time to update them)? You could build a web interface and make it work that way or maybe a file uploader.

But FTP is usually easier to deal with. And if need be, you can still build your interface that you would have had to build for MySQL, but store the file not in the database but in the file system.

I'm pretty sure the file system is where you want to store your templates for performance.

    Well if that's the case then what is it exactly that vBulletin for example does, that is what I'm trying to learn on how to do completely.

      I can come up with examples of PHP web apps that don't use a database to manage their templates.

      What advantages will you have by putting your template in a database? Its a template, so I doubt you'll be performing a lot of text searches (the main text would be built from othe dynamic content pulled possibly from a database).

        Originally posted by AstroTeg
        I can come up with examples of PHP web apps that don't use a database to manage their templates.

        What advantages will you have by putting your template in a database? Its a template, so I doubt you'll be performing a lot of text searches (the main text would be built from othe dynamic content pulled possibly from a database).

        The advantage of a SQL based template system is for multiple sites that maintain the same theming... they can all pull data from the same MySQL database then... other than that.... Filesystem is more efficient I would think

          Why not put the files in a central spot and/or mirror them?

            using the SQL would require 0 extra setup, mirroring would require setting up the mirror, etc etc.

            atleats t hats how I would see it

              Using SQL, wouldn't the sites be sharing the same database? That wouldn't be very groovy if you wanted to keep your data protected. Unless you're using a locked down SQL account.

              Check out rsync and crontab. I believe those two together would get the job done for mirroring (although I could be wrong - I seem to remember these two when I was looking to do some mirroring).

              Again, if you're using SQL, there's not much caching going on. If you use a file system or a mirror, you've got built in caching...

                So how were you doing it before you started to use PHP?

                  Originally posted by Roger Ramjet
                  So how were you doing it before you started to use PHP?

                  I was just having them built into files. The main reason I'd like something to be database stored is later on I can make it so not only myself but other users can easily edit these templates whenever they want, save, and everything will work perfectly fine.

                    Originally posted by TheMayhem
                    I was just having them built into files. The main reason I'd like something to be database stored is later on I can make it so not only myself but other users can easily edit these templates whenever they want, save, and everything will work perfectly fine.

                    I would definitely argue against using a database to store the templates themselves. Store the user info (including privileges) in the database. Then depending on how you do the directory structure, store the path in the database (or store the partial path - it would suck if you changed servers or the directory stucture and you'd have to update the full path in all the records).

                      Originally posted by AstroTeg
                      Using SQL, wouldn't the sites be sharing the same database? That wouldn't be very groovy if you wanted to keep your data protected. Unless you're using a locked down SQL account.

                      Check out rsync and crontab. I believe those two together would get the job done for mirroring (although I could be wrong - I seem to remember these two when I was looking to do some mirroring).

                      Again, if you're using SQL, there's not much caching going on. If you use a file system or a mirror, you've got built in caching...

                      what harm is there in sharing the same styles table (not data tables or even database for that matter, each site would presumably run their own database for data storage on a local server)

                      beyond that, the rest was irrelevant to my explanation so I'll leave it at that

                        When you say "styles" it sounds like a job for CSS which is easily shared.

                        Otherwise, put the file out there and let clients read the file in and process it as they see fit.

                        Sorry, I still don't see the need or advantage to have a database involved.

                        Is there a query you wish to perform that is easier in SQL than if you were to rely on the file system?

                          Write a Reply...