Hi,
I am running Smarty on my site, which has caused me some headaches integrating with vBulletin.
My solution is that I've automated the publishing of these header/footer Smarty-coded files and parse them through Smarty into HTML files (w/ a few vBulletin variables) that vBulletin should be able to import. Obviously I don't want to copy and paste this resulting file into the header/footer DB templates because these will change, and I only want to make header/footer edits in one place.
I've seen the threads with adding a new template for sidebar and the like, but these don't really address my problem of needing to replace the header/footer via the filesystem. What is the best way to do a PHP-style include for these headers/footers that contain vBulletin variables which themselves need parsing?
Thanks!
So a crude start is the "parse_templates" hook. This example is for replacing the template "headinclude" with an external file that gets eval'ed by vBulletin.
Code:
$fd = @fopen( $file_to_include, 'rb' );
$contents = ( $size = filesize( $file_to_include ) ) ? fread( $fd, $size ) : '';
$vbulletin->templatecache[ "headinclude" ] = addslashes( $contents );
fclose( $fd );
I have to addslashes (escape) the double-quotes or I run into a parse error during the eval of the header/footer.
LMK if there are any obvious perils to doing it this way, or if there is a better way.