[geeklog-devel] Fwd: Templating and Caching

Joe Mucchiello joe at ThrowingDice.com
Thu Oct 11 03:29:56 EDT 2007


Well I finally finished the template caching library. It's posted to 
geeklog.net as a hack: 
http://www.geeklog.net/filemgmt/visit.php?lid=871 Mark Evans has been 
running the library on gllabs.org  for a while now so there should 
not be any major issues left with the library.

There are a few code changes needed to core Geeklog in order to make 
it work. They are listed in the readme/install file in the archive 
linked above but I'll post them here. Essentially, some lazy code in 
Geeklog (and its plugins) uses the fact that if you parse a file with 
some of its variables unset, and the later set those variables, the 
final parse('output'....) will catch your mistake. Since this library 
uses include 'cached_file' as its "subst" mechanism, this side effect 
no longer works. Mark says using the library he discovered dozens of 
cases of "sloppy" code and potential bugs in MediaGallery, his next 
release of MG will solve those problems. I've corrected similar bugs 
in forums locally but wasn't fastidious enough to write them all 
down. Sorry Blaine.

The readme/install file in the zip file is 14k. If you have any 
questions, read it first as it is very descriptive of the whys and 
hows of the library. This is excerpted from it:

Problem: The moderation command and control table doesn't look right
Fix: in .../public_html/admin/moderation.php, find this line in the 
function commandcontrol():

         $admin_templates->set_var('cc_icon_width', floor(100/ICONS_PER_ROW));

and move it before the first call to render_cc_item()

Problem: The advanced editor does not display its tools ribbon.
Fix: in .../public_html/lib-common.php, find this code in the 
function COM_siteHeader()

     if( isset( $_CONF['advanced_editor'] ) && ( 
$_CONF['advanced_editor'] == 1 )
             && file_exists( $_CONF['path_layout']
                             . 'advanced_editor_header.thtml' ))
     {
         $header->set_file( 'editor'  , 'advanced_editor_header.thtml');
         $header->parse( 'advanced_editor', 'editor' );

     }
     else
     {
          $header->set_var( 'advanced_editor', '' );
     }

Move the whole block just before these lines:

     // Call any plugin that may want to include extra Meta tags
     // or Javascript functions
     $header->set_var( 'plg_headercode', $headercode . PLG_getHeaderCode() );

     // Call to plugins to set template variables in the header
     PLG_templateSetVars( 'header', $header );

------------
Problem: Admin lists fail to show number of records found.
Fix: In ADMIN_list, find this line of code:

         $admin_templates->parse('search_menu', 'search', true);

Cut it and paste it after this line:

         $admin_templates->set_var ('records_found',
                                    COM_numberFormat ($num_rows));

----
Joe Mucchiello
Throwing Dice Games
http://www.throwingdice.com 




More information about the geeklog-devel mailing list