RE: Smarty with vBulletin?
| From: | Matt Rogish | Date: | Thu, 21 Mar 2002 16:58:48 +0000 |
| Subject: | RE: Smarty with vBulletin? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3212@lists.php.net to get a copy of this message | ||
Jonathan,
There are a couple advantages that I know of as a DBA to keep them in there
(and disadvantages, too).
Since the template table is hit on every page the chances are close to 100%
that all the templates for each page are cached in the database's data
cache. This means templates are pulled from the database server's memory
instead of the web server's disk. So combining the Zend Cache (or whatever
cache) and a DB would result in very few, if any, disk reads on a page view
(our images live on Akamai so we don't worry about serving images either).
When Apache2 is out, though, there may be the ability to create better
caching mechanisms to leave the templates cached within native PHP
mechanisms and globally available to all PHP scripts (so once 'header' is
pulled from the DB it sits in the web server's shared memory pool so all PHP
scripts can touch it instead of going back to the DB). Then the DB would
just be a convenient way to pull info back the first time a template is
called.
What I am trying to figure out with Smarty is how it 'precompiles' so to
speak. If I have conditional logic in PHP to pull different headers back,
will it create a bunch of php files with each template combination? How
will it know which one to pull back for a specific combination?
Another advantage is that most people do daily database backups whereas you
don't really backup your PHP files all that often (once is generally enough
since they don't change at all) so the likelihood of having to re-do your
templates after a crash are lessened. Of course, templates don't change
that often either but it's nice to not have to worry about backing up two
things (although our web boxen are tape-backuped anyway).
I'd be interested to see how forums/threads/posts are done with Smarty -- I
myself don't like the bits either but it makes sense I guess since you're
looping through a result set and you need to apply a uniform look/feel to
each one.
Thanks,
--
Matt
-----Original Message-----
From: Jonathan Chum [mailto:jchum@aismedia.com]
Sent: Thursday, March 21, 2002 6:45 AM
To: smarty@lists.ispi.net
Subject: [smarty] RE: Smarty with vBulletin?
That's something I never understood why vB uses the database to store
templates rather than a file system. I find it much easier to FTP and drop
it into a folder, and it reduces the amount of querying needed just to pull
up a template.
Smarty is quite a great little tool with the CMS I'm working on and it's
quite great when caching is turned on as it reduces the time to generate a
page once the template is fixed.
Internal functions is something cool that I use alot in developing the board
module in which templates could parse timestamps into someting readable.
Also vB does something with loading bits which I find another pain editing
templates while with Smarty, the index page can handle header, categories,
forums, and footer all as one template using Smarty.
Speed wise, it's a tad longer than just eval $strings in the templates, but
for logic that can be possessed in the template, Smarty rocks :)
Regards,
Jonathan
http://www.blazeboard.com
Co-Branded CMS Developed With Smarty