[Tutor] Why not to use include?
W W
srilyk at gmail.com
Mon Jun 9 18:52:44 CEST 2008
On Mon, Jun 9, 2008 at 11:21 AM, Dotan Cohen <dotancohen at gmail.com> wrote:
> 2008/6/9 W W <srilyk at gmail.com>:
> I was doing this in PHP:
> $title="Page title";
> include"/path/to/header.php";
>
So in your header.php you had some source:
echo "<head><title>$title</title></head>\n";
or something to that effect?
> In Python I suppose that I will do something like this:
> makeHeader("Page title")
>
> I would define makeHeader() in a class, so that I could use it (and
> other functions) across multiple pages.
Though I'm not entirely sure how you would (and I'm sure one of the
other web frameworks probably already does such a thing), you could
probably create methods (just a function inside a class, from what
I've been told) that could do something along the lines of:
makeHeader.title("Page title")
makeHeader.bgcolor("#000000")
makeHeader.css("css/mystyle.css")
or any other various types of header information you use, if that sort
of thing fits into your needs/wants. Or even like many functions in
python: makeHeader.body("#00ff00", 0, 0, "images/bgnew.gif"), though
my guess is that again, some other web framework already has those
features.
HTH,
Wayne
More information about the Tutor
mailing list