perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Chamas <jos...@chamas.com>
Subject Re: Subs in GLOBAL.ASA vs. PM
Date Mon, 17 Sep 2001 19:44:19 GMT
Thanos Chatziathanassiou wrote:
> 
> Since the question is on style, how about this:
> I am too bored to write navigational toolbars all the time, so once I have it
> once, in global.asa:
> 
> sub head {
>     my ($page,$title) = @_;
>     return   '<table width="100%" border="0" cellspacing="0" cellpadding="0">'
>                .'<tr bgcolor="#003399"> '
>                .'<td valign="middle" width="84%"><a href="index.asp"><img
> src="images/cine230x60.jpg" width="230" '
>                .'height="60" border="0" hspace="5" vspace="10" align="left"
> alt="Cine.gr"></a> '
>                .'</td>'
>                .'<td valign="bottom" nowrap> '
>                .'<div align="left"> '
>                .'<form method="GET" action="redir.asp" name="quicklink">'
>                .'<nobr><font face="Tahoma" size="2" color="#FFFFFF"><b>Quick
> Links:</b></font> '
>                .'<br>'

I shudder at all that HTML in a perl sub, so I would write it as:

sub head {
  $Response->Include('head.inc', @_);
}
and have the HTML in the head.inc, which I would put in the 
same directory as global.asa.

Or do away with the sub altogether and:
 <% $Response->Include($page, $title); %>

For XMLSubs shorthand of this I might:
  # httpd.conf
  PerlSetVar XMLSubs my:header

and then:
 # global.asa, or my.pm, or My::Tags, which is used in global.asa
 sub my::header {
    $main::Response->Include('head.inc', @_);
 }

so I could finally:
 <my:header title="$title" />

but if you don't want XMLSubs, you could shorthand 
$Response include:

 # global.asa
 sub inc {
   $Response->Include($script, @_);
 }

so you could then:

<% &inc('head.inc', $title); %>

I like perl because TIMTOWTDI :)

> and in each .asp file: <%head('whatever.asp','Page Title')&>
> Is it any good ?
> 

Sure, but I like XMLSubs better.  Make's the page cleaner
with tags like:

 <my:header title="..." />

--Josh
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Mime
View raw message