Hi, I am trying to do a photo gallery for my company. I have created an existing Web-based database to form it. However, I am stuck in trying to order the pictures horizontally and vertically in a page (i.e., 3x3). This is possible in PHP, but I just cannot figure out how to do it in Domino. I hope that you can help.
It can be done using pass-thru HTML. You can either write a LotusScript agent to generate the page HTML using Print statements or use clever macro coding on a form to generate the HTML. With Notes 6, you can also use Domino JSP tags -- refer to "Programming: JSP tag libraries" in the Domino Designer help.
Exactly how to do it depends on how you're storing the pictures. Since you did say 3x3, I'm assuming that you'll have a set of Notes documents, with one file attachment per document, and when they go to a particular view, you'd like to display the images in a 3x3 array rather than in rows like a normal view. If there are more than nine images, you'd like to have next and previous buttons.
@If(@Attachments = 0 | @isDocBeingEdited; @Return(""); ""); picsPerRow := 3; pics := "<IMG SRC="" + @Text(@DocumentUniqueID) + "/ $FILE/" +I've left out all the style tags and column width controls and so on, but you should get the basic idea from this. If you have the attachments in various documents and want to display the "view" of images, you could use a formula like this, but read the "pics" value using an @DbLookup instead of using @AttachmentNames.
@AttachmentNames + "" ALT="" + @AttachmentNames + "">"; picCt := @Elements(pics); rowCt := @Integer((picCt + picsPerRow - 1) / picsPerRow); before := @Explode(@Repeat ("<TR><TD>;<TD>;<TD>;"; rowCt); ";"); after := @Explode(@Repeat("</TD>; </TD>;</TD></TR>;"; rowCt); ";"); pics := @If(@Elements(pics) < @Elements(before); pics : " "; pics); "<TABLE>" + @Implode(before + pics + after; "") + "</TABLE>"
The above will display all the pictures on one page, three columns by however many rows it takes. If you're more interested in showing 3x3 with a Next Page control, then you could use URL arguments to control which is the first image displayed. The formula could use the Query_String CGI variable to find out what the starting number is, take a relevant subset of the "pics" list and show just that.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.