[cgiapp] Adding a div of fixed content to evey page. Possible?

Mark Rajcok mrajcok at gmail.com
Tue Nov 10 17:05:39 EST 2009


I'm late to the party (since I only read the list every few weeks, sorry).

First question, do you really need to have the login form integrated into so
many pages?  The Authentication module does a nice job of presenting a
separate login page when needed, then automatically redirecting you back to
the page you originally tried to get to, if authentication is successful.
Would that work for you?

In a sample CGI:App I wrote, I also wanted a 'user block' at the top of each
page.  If you are not logged in, a "Sign In" link appears, otherwise your
username (which was a link to edit your account info) and a "Sign Out" link
appears.

What I ended up doing was putting 'zz_username' into a "header" template
file.  That header template file is then included by all other
pages/template files.  In cgi_postrun(), string zz_username is substituted
with the appropriate block of HTML.  So, the desired output it inserted
without using the built-in templating system of CGI-App.

If curious, see line 82 of
http://perlmvccgiapp.svn.sourceforge.net/viewvc/perlmvccgiapp/app1_private/modules/BaseCgiApp.pm?revision=47&view=markup

More info:
http://docs.google.com/View?docID=dd363fg9_77gb4hdh7b&revision=_latest#User_Block_07097626585440031_3_16510609953568312

-- Mark

Gurunandan R. Bhat <guru at informationmatters.in> wrote:

>
> 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?
>


More information about the cgiapp mailing list