PHP Classes

File: rope_test

Recommend this page to a friend!
  Classes of Róbert Koszorús  >  ROPE  >  rope_test  >  Download  
File: rope_test
Role: Auxiliary data
Content type: text/plain
Description: example
Class: ROPE
Runtime Operational template Processing Extension
Author: By
Last change:
Date: 18 years ago
Size: 6,676 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
        <HEAD>
                <TITLE>ROPE Test page</TITLE>
        </HEAD>

<BODY BGCOLOR="#c4ccff">

<p align="center"><B>ROPE</B> examples.<br>(For further information see the source code of <i>"rope_test.php"</i>
and the static view of <i>"rope_test.html"</i> )</p><BR>


<ul>

<!-- **** -->
        <li><font size="+1" color="#1e6300"><b><i><u>Simple example</u></i></b></font><br>
        To show how <b>ROPE</b> resolves symboles using <i>&lt;rope:insert&gt;</i> tag <BR>
        </li>

        <br>
        <ol>
        <li>"some[1]" symbol: <rope:insert sym="some[1]"></li>
        <li>"some[2]" symbol: <rope:insert sym="some[2]"></li>
        </ol>

        <br><br><br>

        


        
<!-- **** -->
        <li><font size="+1" color="#1e6300"><b><i><u>Complex iteration example </u></i></b></font><br>
        To show <b>ROPE</b> array iteration, generating and resolving of <b>ROPE</b> local symbols
        using <i>&lt;rope:foreach&gt;</i> and <i>&lt;rope:insert&gt;</i> tags
        </li>

        <br>

        <TABLE BGCOLOR="#c4ccff" FRAME="border" BORDER="2" ALIGN="center">
        <th bgcolor="#fcb0ff">#</th>

        <rope:foreach in="row[0][col]" as="cols" key="colcntr" >
                <th bgcolor="#fcb0ff"><rope:insert sym="colname[$colcntr]"></th>
                
        <rope:next>

        <rope:foreach in="row" as="rows" key="rowcntr">
                <tr>
                <td bgcolor="#e4e199"> <rope:insert sym="rowcntr">. </td>
                <rope:foreach in="rows[col]" as="column" key="colcntr">
                        <td> <rope:insert sym="column"> </td>

                <rope:next>
                </tr>

        <rope:next>
        </TABLE>

        <br><br><br>

        


        
<!-- **** -->
        <li><font size="+1" color="#1e6300"><b><i><u>Conditional example</u></i></b></font><br>
        Which shows the usage of <i>&lt;rope:if&gt;</i> tag:<br>
        </li>

        <br>

        <ul>
        <li>"some_1" symbol:
                <rope:if sym="some[1]">
                        true (is defined) its value is: <rope:insert sym="some[1]">
                <rope:else>
                        false (not defined or its value is null)
                <rope:endif>
        </li>
        <li>"some_2" symbol:
                <rope:if sym="some[2]">
                        true (is defined) its value is: <rope:insert sym="some[2]">
                <rope:else>
                        false (not defined or its value is null)
                <rope:endif>
        </li>
        <li>"some_3" symbol:
                <rope:if sym="some[3]">
                        true (is defined) its value is: <rope:insert sym="some[3]">
                <rope:else>
                        false (not defined or its value is null)
                <rope:endif>
        </li>
        <li>"some_4" symbol:
                <rope:if sym="some[4]">
                        true (is defined) its value is: <rope:insert sym="some[4]">
                <rope:else>
                        false (not defined or its value is null)
                <rope:endif>
        </li>
        </ul>



        <br><br><br>

        


        
<!-- **** -->
        <li><font size="+1" color="#1e6300"><b><i><u>File include example</u></i></b></font><br>
        Which shows the usage of <i>&lt;rope:include&gt;</i> tag:<br>
        </li>

        <br>

        <rope:include file="$include_filename[a][b][c]">


        <br><br><br>

        


        
<!-- **** -->
        <li><font size="+1" color="#1e6300"><b><i><u>"Runtime" example on defining macros, symbols and processing macros</u></i></b></font>
        <br>
         Which shows the usage of <i>&lt;rope:set&gt;</i>, <i>&lt;rope:defmacro&gt;</i> and <i>&lt;rope:domacro&gt;</i> tags
        and their multilevel referencing:<br>
        </li>

        <br>

        <rope:defmacro sym="macrotest">
                The "some" symbols in a foreach block:<br>
                <rope:foreach in="some" as="someval" key="somenum">
                        <rope:insert sym="somenum"> =&gt; <rope:insert sym="someval"><br>
                <rope:next>
        <rope:endmacro>
        
        <rope:set sym="macroname" val="macrotest">
        <rope:set sym="macroname2" val="macroname">

        <rope:domacro sym="$$macroname2">


        <br><br><br>

        


        
<!-- **** -->
        <li><font size="+1" color="#1e6300"><b><i><u>At last a very complex example</u></i></b></font><br>
        Which presents amongst others the usage of <b>ROPE</b> intag attributes:<br>
        </li>

        <br>
        Suppose we want to list the records of a database got as results from an SQL query in the table shown in previous examples
        that way that some of the rows can possess a checkbox and others cannot.
        The IDs and the initial states (checked/unchecked) of the selectable rows are defined in database and also got from the SQL query.
        (<B>QUICK</B> project :))
        Let's work it out with the help of <b>ROPE</b>!<br>

        <br><br>

        <form>
        <TABLE BGCOLOR="#c4ccff" FRAME="border" BORDER="2" ALIGN="center">
        <th bgcolor="#fcb0ff">X</th>

        <rope:foreach in="row[0][col]" as="cols" key="colcntr" >
                <th bgcolor="#fcb0ff"><rope:insert sym="colname[$colcntr]"></th>

        <rope:next>

        <rope:foreach in="row" as="rows" key="rowcntr">
                <tr>

                <rope:if sym="rows[selectable]">
                        <td bgcolor="#e4e199" align="center">
                        <input type="Checkbox" name="checkid_ropeit:isym="rows[id]"" ropeit:isym="rows[checked]">
                        </td>

                <rope:else>
                        <td bgcolor="#e4e199" align="center">-</td>

                <rope:endif>

                <rope:foreach in="rows[col]" as="column" key="colcntr">
                        <td> <rope:insert sym="column"> </td>

                <rope:next>
                </tr>

        <rope:next>
        </TABLE>
        </form>

        <br><br><br>
        
        This example can be a good start point to solve any problem with <b>ROPE</b>.
        Let think about a menu with dynamic deepness which can be generated recursively by a <B>ROPE</B> macro or about the momentary
        state of the menupoints, etc.

        
        </ul>
        
        
</BODY>
</HTML>
For more information send a message to info at phpclasses dot org.