[Tutor] Why not to use include?

Dotan Cohen dotancohen at gmail.com
Mon Jun 9 20:02:32 CEST 2008


2008/6/9 W W <srilyk at gmail.com>:
> 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?

Yes, in general.

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

At what point in the script does the header get output? After the last
makeHeader.something call? I actually do have several variables that I
send to the header include.

Thanks.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


More information about the Tutor mailing list