Hi,

On Tue, Mar 05, 2013 at 09:39:19AM -0800, Νίκος Γκρ33κ wrote:
> But i did, I just tried this:
> 
>       # open html template
>       if htmlpage.endswith('.html'):
>               f = open( "/home/nikos/public_html/" + htmlpage )
> 
>               htmldata = f.read()
>               counter =       ''' <center><a 
> href="mailto:supp...@superhost.gr";> <img src="/data/images/mail.png"> </a>
>                                               <center><table border=2 
> cellpadding=2 bgcolor=black>
>                                                       <td><font 
> color=lime>Αριθμός Επισκεπτών</td>
>                                                       <td><a 
> href="http://superhost.gr/?show=stats";><font color=cyan> %d </td>
>                                       ''' % data[0]
>       else:
>               f = open( "/home/nikos/public_html/cgi-bin/" + htmlpage )
>               
>               htmldata = f.read()
>               counter =       '''
>                                       print '''<center><a 
> href="mailto:supp...@superhost.gr";> <img src="/data/images/mail.png"> </a>
>                                               <center><table border=2 
> cellpadding=2 bgcolor=black>
>                                                       <td><font 
> color=lime>Αριθμός Επισκεπτών</td>
>                                                       <td><a 
> href="http://superhost.gr/?show=stats";><font color=cyan> %d </td>
>                                       '''
>                                       ''' % data[0]   
>                                                       
>       template = htmldata + counter
>       print ( template )
> =============
> 
> But still doens't embed correctly the additional html data at the end of the 
> .py files.....
> 
> Do you have an idea?
as someone said: You're doing it the wrong way.

I would recommend to use a template-engine; then you can put the
complete html-design (and some design-control-structures) into
the template (and *not* into the cgi) and fill data into the
template with a python-script.


Roland
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to