Summary: New footer variable in template
Created: 2006-07-01 12:14
Status: Closed - added in 2.1.16
Category: Feature
Priority: 555

Description: The <!--PageHeaderFmt--> in the template lets cookbook recipes programatically add javascripts at the head.

Could we have one similar to this just before </body> tag so that writing clean html with javascript would be easier.

Examples: Inserting through a recipe google's urchin script or site analysis deepmetrix script. --V.Krishn

See also the GoogleMapAPI recipe, where we have to modify the skin tmpl file for JavaScript use. Des

Presently I am doing the following:
1. In skin.php I have inserted:

global $PageFooterScriptFmt;
foreach ($HTMLFooterFmt as $var => $value) { 
$PageFooterScriptFmt = $PageFooterScriptFmt . "\n" . $HTMLFooterFmt[$var];

2. In skin.tmpl just before </body> I added:


3. Then in each cookbook recipe I insert:

if(!is_array($HTMLFooterFmt)) { 
global $HTMLFooterFmt; $HTMLFooterFmt = array(); 

4. Then just like

$HTMLHeaderFmt['analytics'] = "something"
I would use
$HTMLFooterFmt['analytics'] = "something"

VKrishn August 20, 2006, at 04:49 AM

Actually, it's the <!--HeaderText--> directive that allows things to be placed in the head, not <!--PageHeaderFmt-->.

So, in order to programmatically insert things before the closing </body> tag, we'd need a special <!--FooterText--> directive. I'll think about finding some way to add it, if it's still needed. --Pm

Thanks for pointing <!--HeaderText-->, it was a copy paste mistake from the template I was working on.

Yes, it would help to ease and reduce scripting in my recipes that I was working on, Apart from that it would also help in making the code clean while inserting javascipts on page. VKrishn August 24, 2006, at 03:39 AM

This feature was added in 2.1.16. Footer values can go into $HTMLFooterFmt, and the directive to include them in skins is <!--HTMLFooter-->.

In addition, as noted in the ReleaseNotes, the <!--HeaderText--> directive is now called <!--HTMLHeader-->, to better illustrate the correspondence between the directive and the variable it uses, as well as to hopefully avoid confusion we observed between <!--HeaderText--> and <!--PageHeaderFmt-->.