[Zope] including external html fragments

Amos Latteier amos@aracnet.com
Fri, 30 Jul 1999 15:18:32 -0700


At 05:47 PM 7/30/99 -0400, Sean Robertson wrote:
>Can anyone help me figure out how to include an external HTML fragment?
>Here is the basic code fragment, with (obviously) incorrect include
>statements.  I looked at the docs, but am having a hard time making sense
>out of it.

I'm not sure what you mean by "external HTML fragment". If you are
referring to DTML Method or DTML Document objects, the normal way to
include them is to use the 'var' tag.

If you are talking about HTML resources on remote servers, Zope doesn't
have any built-in methods for fetching them and putting them in your
templates, though it would be quite simple to write an external method to
do this with python's standard urllib module:

  import urllib

  def fetch_url(self, url):
      """fetch content from a remote url
      and return it as a string"""
      return urllib.urlopen(url).read() 

Hope this helps.

-Amos