Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

Web ページでの継承の使用

UtilsShowTimes のスーパー・クラスにすると、便利な ..MethodName 構文を使用し、Utils で定義されたすべてのメソッドに、ShowTimes 内でアクセスできます。このメソッドには、AddShow も含まれます。

この関係を示すには、<csp:class> タグのスーパー属性を通して Utils をページのスーパークラスとして定義します。これは ShowTimesUtils クラスで定義された、すべてのメソッドを使用できるようにします。

ShowTimesUtils. のサブクラスにする必要はないことに注意してください。AddShow はクラス・メソッドなので、コンテキストによって ##class(PackageName.ClassName).MethodName 構文または PackageName.ClassName.MethodName 構文を使用して ShowTimes 内でアクセスすることができます。これらの方法では、UtilsShowTimes のスーパークラスである必要はありません。ただし、構文は ..MethodName に比べるとあまり便利ではありません。

—ShowTimes.csp—
ShowTimes.csp
<html> <body>
<csp:class encoded=1 super="%CSP.Page,Cinema.Utils">

<csp:query 
        name="Times" 
        classname="Show" 
        queryname="ShowTimes" 
        P1='#(%request.Data("FilmID",1))#'>
<csp:object 
        name="Film" 
        classname="Cinema.Film" 
        objid='#(%request.Data("FilmID",1))#'>

<font> <b>Today's Show Times for #(Film.Title)#</b></font>

<table cellpadding=5>
    <tr>
    <td><b>Time</b></td>
    <td><b>Theater</b></td>
    </tr>
<csp:while condition="Times.Next()">
    <tr>
    <td>#(Times.GetDataByName("StartTime"))#</td>
    <td>#(Times.GetDataByName("TheaterName"))#</td>

    </tr>
</csp:while>
</table>
</body> </html>
FeedbackOpens in a new tab