From 8ad1189b8c6429d769249958b2044ca6898206be Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 12 May 2006 15:19:16 +0000 Subject: [PATCH] added matts thing to prevent template headers from going out multiple times --- lib/WebGUI/Asset/Template.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/WebGUI/Asset/Template.pm b/lib/WebGUI/Asset/Template.pm index 380369239..0f44c7ef6 100644 --- a/lib/WebGUI/Asset/Template.pm +++ b/lib/WebGUI/Asset/Template.pm @@ -18,7 +18,7 @@ use strict; use base 'WebGUI::Asset'; use WebGUI::International; use WebGUI::Asset::Template::HTMLTemplate; - +use WebGUI::Utility; =head1 NAME @@ -267,11 +267,16 @@ This method sets the tags from the head block parameter of the template into the sub prepare { my $self = shift; $self->{_prepared} = 1; - if ($self->session->style->sent) { - $self->session->output->print($self->get("headBlock")); - } else { - $self->session->style->setRawHeadTags($self->get("headBlock")); + my @sent = @{$self->session->stow->get("templateHeadersSent")}; + unless (isIn($self->getId, @sent)) { # don't send head block if we've already sent it for this template + if ($self->session->style->sent) { + $self->session->output->print($self->get("headBlock")); + } else { + $self->session->style->setRawHeadTags($self->get("headBlock")); + } } + push(@sent, $self->getId); + $self->session->stow->set("templateHeadersSent", \@sent); }