[geeklog-devel] lib-layout.php

Mark R. Evans mevans at ecsnet.com
Fri Jan 4 00:28:17 EST 2008

If you look at what Chameleon does, it actually duplicates 99% of the 
code in COM_siteHeader() and COM_siteFooter(). The 1% I left out was the 
logic on whether the left / right blocks are built in the header / 
footer.  We had to add a lot of code to do things the new CSS based way 
as well.   Chameleon renders the full page in COM_siteFooter() which is 
very different from how the stock functions work.  Originally, all I had 
COM_siteHeader() do was set the global variables for the parameters 
passed.  It wasn't until I realized that some plugins don't buffer the 
COM_siteHeader() call or their output that I created a new template, 
htmlheader.thtml and now send the HTML headers in COM_siteHeader().  The 
rest of the heavy lifting is all done in COM_siteFooter().  The #1 goal 
of this approach is to render the content first, then the left / right 
if enabled.  Unless I'm missing something, the only way to do it as 
Geeklog is currently designed is to do it in the COM_siteFooter() call, 
along with a little PHP magic to force the buffering of plugins / 
Geeklog's content.

 From the perspective of the Chameleon approach, adding a set of 
functions with the template handle as a parameter won't give me the 
control I need to accomplish what we're doing.  I can certainly see some 
value for themes that continue to use the table based structure.  It 
would add the ability to easily add or modify certain aspects of the 

Personally, I would just remove COM_siteHeader() / COM_siteFooter() 
completely from lib-common.php and put it in the themes functions.php.  
Generally the first step in creating a new Geeklog theme is to copy 
Professional over and start hacking.  I don't see the functions.php as 
any different than a specific template file.   This would give each 
theme full control over the functions without having any duplicate or 
unnecessary code sitting around.

Obviously this would have to be a staged approach.  Maybe in v1.5 you 
have if (!function_exists('COM_siteHeader')) ... so it is duplicated in 
both places (lib-common and function.php), but it gives a safety net for 
folks with custom themes to just make the necessary template changes 
after upgrading.  Then in 1.5.1 or 1.6 or whatever is the next major 
release, they come out of lib-common.php completely.

If they stay in lib-common and are enhanced by new functions in 
lib-layout.php, I would ask that the ability to override by the theme 
not be removed. 


Blaine Lang wrote:
> I was looking at how we could make it easier to create theme specific 
> siteHeader and siteFooter functions - specifically with Chameleon but 
> I've also had to create theme specific functions in the past. It's not 
> hard - copy/paste and modify but 90% of the code or more is the same 
> as in the lib-common functions and these functions evolve every 
> release. Chameleon has moved some of the code from COM_siteHeader into 
> COM_siteFooter (theme versions) but still it's mostly restructuring of 
> code chunks.
> I was thinking that it may be a good idea to create a set of functions 
> which take the &$template variable which would be called by the header 
> and footer related functions. This way the code to set the siteheader 
> menu could be called in the header or footer function, same for the 
> code to generate the left or right blocks etc.
> Reason to consider this now is for easier ongoing support of custom 
> themes.
> Is this a new feature or a change (not sure)
> Is it worth doing as part of 1.5 - thats the ?
> Blaine
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://eight.pairlist.net/mailman/listinfo/geeklog-devel

More information about the geeklog-devel mailing list