[cgiapp] Adding a div of fixed content to evey page. Possible?
Gurunandan R. Bhat
guru at informationmatters.in
Fri Oct 30 15:14:19 EDT 2009
First, Thanks for responding.
Are you suggesting that I populate a template variable with another
HTML::Template-tagged piece and then populate that piece in postrun? If
yes, wouldn't I have to do that in every runmode - something that I
wanted to avoid?
Would it not be better if I called $app->param(LOGINFORM => 'Content of
Form') (as opposed to $tpl->param()) in prerun and have it set for every
runmode without doing so explicitly in each runmode?
I am not getting it. My bad, obviously
On Fri, 2009-10-30 at 14:55 -0400, Brad Van Sickle wrote:
>
> You can initialize and populate your template in postrun as well.
>
> The way I do it is I typically load the framework of the page using
> HTML::Template in postrun, and then insert the output of my runmode into
> the template where required.
>
> If your runmode output is complex enough to require being templated
> itself, there isn't anything stopping you from using HTML::Template
> within the runmode to format the output and then inserting the output of
> that template into the overall template in postrun.
>
> You can even move postrun up into a superclass to centralize all of this
> content and keep a coherent look on your site.
>
> At least that's the easiest and most flexible solution I found when I
> was faced with a similar problem...
>
>
> >
> >
> >
> > Gurunandan R. Bhat wrote:
> >> Yes thats what I want to do. To be specific, I want to insert a login
> >> form on every page or a logged-in status depending on whether
> >> $app->authen->username is defined or not (I am using
> >> CAP-Authentication).
> >>
> >> But when I am in post-run, HTML::Template has done its job and no
> >> template variables are available any more - unless I use another
> >> templating system that will process the plain text available in postrun.
> >> In the light of this I am not sure how your suggestion will work.
> >>
> >> Unless I haven't really understood what is available to postrun.
> >>
> >> REgards
> >> Gurunandan
> >>
> >>
> >> On Fri, 2009-10-30 at 14:40 -0400, Brad Van Sickle wrote:
> >>
> >>
> >>> In postrun you can populate a variable with a subroutine call and then
> >>> substitute that variable anywhere in your template, or even insert it
> >>> into your runmode output if desired.
> >>>
> >>> Is that what you are looking for, or am I way off base?
> >>>
> >>>
> >>>
> >>> Gurunandan R. Bhat wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> Is it possible to add the output of a template to every page/run-mode
> >>>> without going through assigning it to a template->param in each
> >>>> run-mode?
> >>>>
> >>>> I am aware of using cgi-postrun to wrap the output of a run-mode, but it
> >>>> seems not possible to *insert* a div of content in an arbitraty (but
> >>>> fixed position) using this trick. Or is it?
> >>>>
> >>>> I would also like to avoid another template processor (like HTML::Mason
> >>>> or Text::Template) to do this if there is an easier way.
> >>>>
> >>>> Thanks for your attention
> >>>> Gurunandan
> >>>>
> >>>>
> >>>> ##### CGI::Application community mailing list ################
> >>>> ## ##
> >>>> ## To unsubscribe, or change your message delivery options, ##
> >>>> ## visit: http://lists.openlib.org/mailman/listinfo/cgiapp ##
> >>>> ## ##
> >>>> ## Web archive: http://lists.openlib.org/pipermail/cgiapp/ ##
> >>>> ## Wiki: http://cgiapp.erlbaum.net/ ##
> >>>> ## ##
> >>>> ################################################################
> >>>>
> >>>>
> >>>>
> >>> ##### CGI::Application community mailing list ################
> >>> ## ##
> >>> ## To unsubscribe, or change your message delivery options, ##
> >>> ## visit: http://lists.openlib.org/mailman/listinfo/cgiapp ##
> >>> ## ##
> >>> ## Web archive: http://lists.openlib.org/pipermail/cgiapp/ ##
> >>> ## Wiki: http://cgiapp.erlbaum.net/ ##
> >>> ## ##
> >>> ################################################################
> >>>
> >>>
> >>
> >>
> >>
> >> ##### CGI::Application community mailing list ################
> >> ## ##
> >> ## To unsubscribe, or change your message delivery options, ##
> >> ## visit: http://lists.openlib.org/mailman/listinfo/cgiapp ##
> >> ## ##
> >> ## Web archive: http://lists.openlib.org/pipermail/cgiapp/ ##
> >> ## Wiki: http://cgiapp.erlbaum.net/ ##
> >> ## ##
> >> ################################################################
> >>
> >>
>
> ##### CGI::Application community mailing list ################
> ## ##
> ## To unsubscribe, or change your message delivery options, ##
> ## visit: http://lists.openlib.org/mailman/listinfo/cgiapp ##
> ## ##
> ## Web archive: http://lists.openlib.org/pipermail/cgiapp/ ##
> ## Wiki: http://cgiapp.erlbaum.net/ ##
> ## ##
> ################################################################
>
More information about the cgiapp
mailing list