[Zope] Using pythonbased products (rbickers Photo) from Page Templates

Edward Muller edwardam@interlix.com
13 Sep 2002 10:43:43 -0500


--=-b26UN/2NrFJ+Z2O9c+/U
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

This is the core of my ZPT thumbnail viewer.

I haven't finished it or the 'view' object yet, but I use this bit of
code to display my thumbnail views
<table tal:define=3D"photos container/PhotoList" align=3D"center"
cellpadding=3D"0" cellspacing=3D"5">
	<tr tal:repeat=3D"cur python:range(0,len(photos),4)">
		<td tal:repeat=3D"item
python:modules['ZTUtils'].Batch(photos,size=3D4,start=3Dcur)"
align=3D"center">
			<a href=3D"" tal:define=3D"url python:item.getId() + '/view'"
	        		   tal:attributes=3D"href url">
				<p tal:replace=3D"structure python:item.tag(display=3D'thumbnail',
border=3D0, cookie=3D0)"></p>
				<br/>
				<p tal:replace=3D"structure item/title_or_id">title_or_id</p>
			</a>
		</td>
	</tr>
</table>

The 'PhotoList' object is a pythonscript as follows:

return container.objectValues('Photo')

This can probably be replaces with a python: thingie ... just haven't
done it yet.

Hope this helps.

On Mon, 2002-09-02 at 16:45, Jochen Haeberle wrote:
> Hi,
>=20
> I am banging my head against the wall trying to figure out how I=20
> would best use rbickers Photo-Product from Page Templates, but I=20
> guess the problem is the same for any Zope-Product that does not come=20
> with ZPT-Support out of the box.
>=20
> I guess, one can use the Photo product without any real problem, for=20
> example, I can do
>=20
> <a Href=3D"#" tal:attributes=3D"href string:${my_batch/id}/view">
>    <img src=3D"image.jpg" tal:attributes=3D"src=20
> string:${my_batch/id}?display=3Dthumbnail">
> </a>
>=20
> to show the thumbnails of my Photos and link to the "view" method,=20
> but is this really TAL???
>=20
> I am able to call some methods on the PhotoObjects as well like
>=20
> <ul>
>    <li tal:repeat=3D"displays here/displayLinks" tal:content=3D"structure=
=20
> displays">Link to a size</li>
> </ul>
>=20
> To get the links to different size-links...
>=20
> ...but how would I express
>=20
> <dtml-var "tag(display=3DREQUEST.get('display', 'small'), border=3D0, coo=
kie=3D1)">
>=20
> in TAL to get the cookie-enabled version of the Photo???
>=20
>=20
> In general, what's the best way to learn how to use existing products=20
> in Templates??
>=20
>=20
> Thanks in advance
>=20
> Jochen
>=20
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -=20
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )


--=-b26UN/2NrFJ+Z2O9c+/U
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQA9ggeurFLxV7skhR0RAuMSAJ4+QqOu1vCQSEBwM7kAAjN9IMbutgCeLQC3
u7Rb+7E9sFyh0gVVYDGQgvc=
=F5gP
-----END PGP SIGNATURE-----

--=-b26UN/2NrFJ+Z2O9c+/U--