[Zope3-Users] A View combining graphics and HTML

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Oct 30 11:30:46 EST 2006


On Thursday 19 October 2006 07:08, thealx at poczta.onet.pl wrote:
> Hello, I need to display my content object (container of statistical data
> points) in a kind of "dual view":
>  - Chart (PNG generated server-side) 
>  - Data table below the chart (i.e piece of HTML)

Okay, no problem.

> I'm currently planning to display this using the following design:
> - Create a BrowserView returning HTML data table

Correct.

> - Create a BrowserView returning Chart (with image/png content type set)

Correct.

> - Create a ViewletManager containing two viewlets, one for HTML, one for
> Chart (each viewlet's render() calls one of above views) 
> - Create a master BrowserView which calls this ViewletManager.

Those last two steps are bonus and would be nice to have, if you want to reuse 
the code snippets. However, you could do it all in the template of the first 
browser view as well. I would try a simple version first and then switch to 
viewlets.

> Could you give me a hint if such a design will be reasonable and efficient
> for such purpose, or this problem may be solved in other (simpler) way?

The simple way:

content/statistics.html
content/graph.png

statistics.pt
...
<table>...</table>
<img src="graph.png" />
...

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list