RE: Smarty with vBulletin?

From: Date: Thu, 21 Mar 2002 12:41:41 +0000
Subject: RE: Smarty with vBulletin?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3216@lists.php.net to get a copy of this message
Yea, I suppose in that regards, one could cache the templates needed in one query and cache the results into memory so it can be served much faster. So just one query is needed then. . . The way I use Smarty in respect as one template controlling the logic of a sample vBulletin page is that in Smarty, you define loops and sub loops to render out forums for a category if need be. This keeps the index page to just one template rather than having bits and pieces and you can give a web designer to design a layout and put in the logic as to what table rows needs to be looped a certain way. Only thing that is bit more complicate to handle is how arrays are passed into the tempalte to generate a threaded listing where handling templates as bits and pieces would work great, but adds alot of time to construct templates as you'll have to chop your original templates. I recall how many vB users didn't like having 100s of bits of templates here and there. Smarty can pull fetch templates out of the database though, so I don't think there's too much trouble to getting it to work with vB. http://www.phpinsider.com/php/code/Smarty/contribs/examples/linkdemo/linkdem o.tpl.txt Is a good example of one template generated a heiarchial index similiar to vB's index page. I also believe there in Smarty, you can generate custom function as to where you want to pull a template from, so I think, templates could be stored into memory and you can custom create a Smarty extension to fetch the template from memory so it can be parsed. -----Original Message----- From: Matt Rogish [mailto:matt@fanhome.com] Sent: Thursday, March 21, 2002 4:59 PM To: smarty@lists.ispi.net Subject: [smarty] RE: Smarty with vBulletin? 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 --- You are currently subscribed to smarty as: jchum@aismedia.com To unsubscribe send a blank email to $subst('Email.Unsub') Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/

« previous php.smarty.general (#3216) next »