next >>
<< prev


01 02 03
 
/*
*Tea Template Language Code Sample - Marc Needham - 02/21/01
*Tea is the language I use at Disney to put the logic behind such
*wonderful pages as Wall of Sound, Mr. Showbiz, and Movies.com.
*Tea, as you will see below, is a lot like a Java-based ASP, only it builds
*pages as they are published rather than on-the-fly.
*This code below was used to test if there was a picture in a certain
*object, if there was a picture, the code displayed it, if there
*wasn't, then it displayed a standard blank picture.
*I just like it because I of the way I used the loops. Not the most complex
*logic I have ever put together but it is tidy and nice.
*Oh, I also removed my comments from the code so that you can
*have a better look at it. I generally write very well commented code.
*/

<%
counter = 0;
numpictures = 3;
biotitle = "";
biolen = 0;
imagesrc = "";
if(obj.matches != null) {
    foreach (person in obj.matches) {


        if (counter < numPictures) {
            counter = counter + 1
            if ((person.filename != null) and (person.filename != "")){
                if ((person.imagename != null) and (person.imagename != "")){
                    biolen = person.imagename.length
                    biolen = (person.imagename.length - 7)
                        if (biolen > 0){
                            biotitle = substring(person.imagename, 0, biolen)
                        }
                        if (biotitle&'bio.jpg' == person.imagename){
                        imagesrc = "/celebrities/img/<%person.imagename%>";
                        }
                        if (biotitle&'bio.jpg' != person.imagename){
                        imagesrc = "/celebrities/img/blankstar_img.gif";
                        }                                    
                }    
%>
				<table border="0" cellpadding="0" cellspacing="0" width="155" bgcolor="#9A9DC4">
					<tr>
						<td rowspan="3" width="2">  
						</td>
						<td colspan="2">
						<a href="http://mrshowbiz.go.com/cgi/lovematch/request.dll?mailcard&person_id=<%
 person.person_id %>&imagename=<%person.imagename%>&name=<%person.firstname%>%20<%person.lastname%>&width=<% person.imagewidth %>&height=<% person.imageheight %>&filename=<% person.filename %>"><img src="/features/celebritylovematch/images/env.gif" vspace="0" hspace="0" border="0"></a>
						</td>
						<td rowspan="3" width="2">  
						</td>
					</tr>
					<tr>
						<td colspan="2">
						<a href="/celebrities/people/<% person.filename %>/index.html"><img src = "<%imagesrc%>" border="0"></a><br>
						</td>
					</tr>
					<tr>
						<td valign="top" width="118"><a href="/celebrities/people/<% person.filename %>/index.html"><font size="2" face="verdana,geneva,helvetica" color="white" style="text-decoration: none;"><b><% if(person.firstname!="null") {person.firstname} %> <br><% person.lastname %></b></font></a>
						</td>
						<td width="37">
						<img src="/features/celebritylovematch/images/<% toLowerCase(person.starsign) %>.gif" alt="<% person.starsign %>" vspace="0" hspace="0" align="right">	
						<br>
						</td>
					</tr>
				</table>
				
				<br clear="all">				
<%
            } else {
%>
				

				
				<table border="0" cellpadding="0" cellspacing="0" width="155" bgcolor="#9A9DC4">
					<tr>	
						<td rowspan="3" width="2">  
						</td>
						<td colspan="2">	
						<a href="http://mrshowbiz.go.com/cgi/lovematch/request.dll?mailcard&person_id=<% person.person_id %>&imagename=<%person.imagename%>&name=<%person.firstname%>%20<%person.lastname%>&width=<% person.imagewidth %>&height=<% person.imageheight %>"><img src="/features/celebritylovematch/images/env.gif" vspace="0" hspace="0" border="0"></a>
						</td>
						<td rowspan="3" width="2">  
						</td>
					</tr>
					<tr>
						<td colspan="2">
						<img src = "<%imagesrc%>" border="0" width="152" height="156"><br>
						</td>
					</tr>
					<tr>
						<td valign="top" width="118"><font size="2" face="verdana,geneva,helvetica" color="white"><b><% if(person.firstname!="null") {person.firstname} %> <br><% person.lastname %></b>
						</td>
						<td width="37">
						<img src="/features/celebritylovematch/images/<% toLowerCase(person.starsign) %>.gif" alt="<% person.starsign %>" vspace="0" hspace="0" align="right">	
						<br>
						</td>
					</tr>
				</table>
				
				
				<br clear="all">
<%
            }
        }
    }
}
%>