On Sunday 08 June 2008 17:13:21 Dotan Cohen wrote: > 2008/6/8 Kent Johnson <[EMAIL PROTECTED]>: > > On Sun, Jun 8, 2008 at 6:46 AM, Dotan Cohen <[EMAIL PROTECTED]> wrote: > >> I am moving a website from php to python gradually. The first step is > >> replacing the page headers and footers. > > > > I'm not sure how you plan to do this. PHP programs are embedded into > > web pages. Python web programs output the contents of the web page. > > This is pretty different. > > 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?
Generally no. Furthermore, Python is pretty bad language to embed in HTML, as whitespace is significant in Python. > > >> 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. Python discourages the use of includes > > > > Python doesn't have anything that functions like an include to > > incorporate a literal block of text from an external file. I guess you > > could call that discouragement.... > > Could I do something similar with a function? Something like > printHeader() and I would define that function in a class? Consult http://wiki.python.org/moin/WebProgramming first, please ;) Andreas
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor