Pierre Rougier wrote:
Hi, OK, part of my zope pages are inserted from another site (like frames, but without frames). What must make my product is taking these external pages, treating the HTML code and print it with some new features. When the user clicks a link of this inserted page, I want to intercept the request, treat the URL to go and searsh the HTML code to insert it in my page. Is it possible to do it??? How???
Thank you for your attention.
Pierre.
P.S.: If you speak french, please do it in your answer!
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Facile !... (façon de parler...) Deux solutions à deux problèmes différents : 1- Pour rediriger une page vers une autre, utiliser la syntaxe suivante : <dtml-call "REQUEST.redirect (<url>)"> Dans ce cas, on n'a pas accès au contenu html de la page. 2 - Pour avoir accès au contenu HTML d'une page extérieure au site, il faut utiliser la méthode externe suivante (trouvée dans un HowTo du site Zope, que je sois pardonné pour l'emprunt sans mention de l'auteur....) : import httplib def GetURL(site, filename): from httplib import HTTP http = HTTP(site) http.putrequest('GET', filename) http.putheader('Accept', 'text/html') # we can handle text/html http.putheader('Accept', 'text/plain') # we can handle text/plain http.endheaders() httpcode, httpmsg, headers = http.getreply() # get response headers if httpcode != 200: raise "Could not get document" # HTTP error doc = http.getfile() data = doc.read() # read file doc.close() return data Ensuite, après avoir inséré l'External Method dans la hierarchie de Zope, pour récupérer le texte html d'une URL distante, utiliser la syntaxe suivante : <dtml-let mapage="GetURL ('www.toto.com', '/index.html')"> // Traitements... </dtml-let> 3- Pour accéder au contenu d'une page interne au site, utiliser une référence du style : <dtml-let mapage="_['page_a_traiter']"> </dtml-let> Et voilà !... Pierre-Julien GRIZEL