Login   Register  
PHP Classes
elePHPant
Icontem

File: testscript

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Róbert Koszorús  >  ROPE  >  testscript  >  Download  
File: testscript
Role: Example script
Content type: text/plain
Description: example script
Class: ROPE
Runtime Operational template Processing Extension
Author: By
Last change:
Date: 2004-01-16 03:54
Size: 3,630 bytes
 

Contents

Class file image Download
<?php
/////////////////////////////////////////////////////////
//
// program:                        ROPE Aplication Examples
// module:                        Main
// coder:                        Koszorus
// date:                        20. 09. 02
// modify:                        29. 07. 03
// system:                        Web (HTML/PHP/ROPE)
// interpreter:                PHP4
// Version:                        2.12
//
/////////////////////////////////////////////////////////
require_once( "rope_oo.php" );

$my_globals["some"][1] = "Some text 1";
$my_globals["some"][2] = "Some text 2";
$my_globals["some"][3] = 0;
$my_globals["some"][4] = "";

if ( 
$lang == "en" )
        
$my_globals["include_filename"]["a"]["b"]["c"] = "test_inc_en.html";
else
        
$my_globals["include_filename"]["a"]["b"]["c"] = "test_inc.html";

/*
// **** here is a MySQL query for example: ****

$query_result =  mysql_query( ... )

$query_row_cntr = 0;
while ($query_row = mysql_fetch_assoc( $query_result) )
{
        $query_col_cntr = 0;
        foreach( $query_row as $query_name => $query_val )
        {
                $my_globals["row"][$query_row_cntr]["col"][$query_col_cntr] = $query_val;
                //...
                //...
                
                $query_col_cntr++;
                
        }//for

        $query_row_cntr++;

}//while
*/

// **** the MySQL query above generates something like this: ****
// change it for testing ROPE!!!
$my_globals["row"][0]["id"] = 10;
$my_globals["row"][0]["selectable"] = 1;
$my_globals["row"][0]["checked"] = "checked";
$my_globals["row"][0]["col"][0] = "Robert";
$my_globals["row"][0]["col"][1] = "Koszorus";
$my_globals["row"][0]["col"][2] = "REIDEA Informatic";
$my_globals["row"][0]["col"][3] = "Hungary";
$my_globals["row"][0]["col"][4] = "koszorus@nowhere.hu";

$my_globals["row"][1]["id"] = 1;
$my_globals["row"][1]["selectable"] = 1;
$my_globals["row"][1]["checked"] = "";
$my_globals["row"][1]["col"][0] = "Attila";
$my_globals["row"][1]["col"][1] = "Zsebi";
$my_globals["row"][1]["col"][2] = "Pocketbase";
$my_globals["row"][1]["col"][3] = "Hungary";
$my_globals["row"][1]["col"][4] = "zsebi@nospam.please";

$my_globals["row"][2]["id"] = 21;
$my_globals["row"][2]["selectable"] = 0;
$my_globals["row"][2]["checked"] = "";
$my_globals["row"][2]["col"][0] = "Some";
$my_globals["row"][2]["col"][1] = "Body";
$my_globals["row"][2]["col"][2] = "Some Co.";
$my_globals["row"][2]["col"][3] = "Eldorado";
$my_globals["row"][2]["col"][4] = "who@where";

$my_globals["row"][3]["id"] = 2;
$my_globals["row"][3]["selectable"] = 1;
$my_globals["row"][3]["checked"] = "";
$my_globals["row"][3]["col"][0] = "Lacko";
$my_globals["row"][3]["col"][1] = "Hege";
$my_globals["row"][3]["col"][2] = "OMSZ";
$my_globals["row"][3]["col"][3] = "Hungary";
$my_globals["row"][3]["col"][4] = "lacko@mentok.hu";



// **** with  an other simple MySQL qery you can get the name of fields(or anything what you want there are no ranges :)):
// we store some fictive column name for demonstrate multiple reference of ROPE local symboles
$my_globals["colname"][0] = "First name";
$my_globals["colname"][1] = "Last name";
$my_globals["colname"][2] = "Company";
$my_globals["colname"][3] = "Country";
$my_globals["colname"][4] = "E-mail";


$rope = new rope_class;

// call ROPE to process the template with our  global symboles
if ( $lang == "en" )
        
$rope->rope_process"rope_test_en.html"$my_globals );
else
        
$rope->rope_process"rope_test.html"$my_globals );

?>