[Tutor] Why not to use include?
Kent Johnson
kent37 at tds.net
Sun Jun 8 20:05:52 CEST 2008
On Sun, Jun 8, 2008 at 11:13 AM, Dotan Cohen <dotancohen at gmail.com> wrote:
> Very little of the pages are PHP, most is HTML. I understand that
> Python can be used as a web scripting language, so I assume that
> Python can be run in Apache from a page with an .html extension. Is
> this not the case, with an .httaccess directive?
Maybe you want Python Server Pages?
http://www.modpython.org/live/current/doc-html/pyapi-psp.html
>
>>> Currently, each page begins
>>> with <?php include "header.php"; ?> which contains the <head> porton
>>> of the html and the html code to present the website name and logo.
>>> Each page ends with <?php include"footer.php"; ?> which includes a
>>> footer note and the closing body and html tags. Of course this is a
>>> generalization, but the point is that I need to do something similar
>>> in Python.
Maybe the parse() function in PSP would do this.
> Could I do something similar with a function? Something like
> printHeader() and I would define that function in a class?
Yes, probably. You don't need to put it in a class, though.
There are many different ways to create web pages in Python and the
answers to your questions will be different depending on which method
you choose so it's hard to be specific here.
Kent
More information about the Tutor
mailing list