Skip to main content

Displaying the Category Name

Here we customize the text at the top of the page to include the category name, where applicable. If there is a cookie and if that cookie contains a valid ID for a FilmCategory instance, then we assign CatName the value of the CategoryName property of that FilmCategory instance.

—TopPicks.csp—
TopPicks.csp
<html> <body>
<script language="cache" runat="server"> 
   Set CatID = %request.GetCookie("CacheCinemaLastCategory")
   set CatName = ""
   if (CatID '= "") {
        set Cat = ##class(Cinema.FilmCategory).%OpenId(CatID)
        if (Cat '= "") {
            set CatName = Cat.CategoryName
        }
    }
</script>
<h2><font color="#0000FF">Today's #(CatName)# Top Picks</font></h2>
<table border=0>
<csp:query 
        name=FilmList 
        classname="Cinema.Film" 
        queryname='#(Query)#' P1=#(CatID)#>
<csp:while condition="FilmList.Next()"> ... </csp:while>
</table>
</body> </html>
FeedbackOpens in a new tab