[Zope] how to tell if displayed in a frame
Jim Washington
jwashin@vt.edu
Fri, 10 Mar 2000 09:19:39 -0500
It can be done in server-side code, if you know when you put the
document in a frame or not.
Something like the following might help:
In the document in question, do some code like:
<dtml-if in_frame>
...display definitely in frame
<dtml-elif not_in_frame>
...display definitely not in frame
<dtml-else>
...default display, which may be the same as one of the above
</dtml-if>
You will probably want to factor out the duplicated content into
subsidiary methods.
Now, if you want the default view, call it as <dtml-var mydoc>
If you want it in its frame view, call it as <dtml-var "mydoc(_.None, _,
in_frame=1)">
You might want to make a dtml method called e.g. myframedoc with the
above code so you can call it as a url.
<frame src="myframedoc" title="blah">
Another way is to call the document in HTTP:get format in the frameset.
like: <frame src="mydoc?in_frame=1">
Regards,
-- Jim Washington
Andy Heath wrote:
>
> I have a page that sometimes gets displayed in a frame
> and sometimes in the main window. I want it to be
> display differently (with a header) when its not
> in a frame. Is there a way I can do this?
>
> I don't suppose the name of the target frame
> gets passed to the browser does it?
>
> Presumably the only way to do this would be
> to do it in client-side code and fecth the header
> if appropriate and filter it to make it what is
> needed. Or is it?
>
> Andy
> --
> -------------------------------------------------
> Andy Heath a.k.heath@open.ac.uk
> The Open University +44 (0) 114 2885738
>
> _______________________________________________
> 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 )