Location: PHPKode > scripts > RFKmap > rfkmap/rfkmap.html
<HTML>
	<HEAD>
		<TITLE>RFKmap 1.4 - A PHP extension for mapping queries to templates</TITLE>
	</HEAD>
<BODY>
<!-- INDEX BEGIN -->
<UL>
	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#COREMETHODS">CORE METHODS</A>
	<UL>
		<LI><A HREF="#newconstructor">new( ref_template_var, KEY, [array( key,value pairs)] )</A>
		<LI><A HREF="#view_only">view_only( ref_template_var, $select_unique, [$select_multiple], [$select_relation], [$query_plus] )</A>
		<LI><A HREF="#view_only_parse">view_only_parse( ref_template_var, [HANDLE] )</A>
		<LI><A HREF="#view_list">view_list( ref_template_var, $select_unique, [$select_multiple], [$select_relation], [$query_plus] )</A>
		<LI><A HREF="#view_list_parse">view_list_parse( ref_template_var, [HANDLE] )</A>
	</UL>	
	<LI><A HREF="#OTHERMETHODS">OTHER METHODS</A>
	<UL>
		<LI><A HREF="#view_only_fetch">view_only_fetch( ref_template_var )</A>
		<LI><A HREF="#view_list_fetch">view_list_fetch( ref_template_var )</A>
		<LI><A HREF="#view_only_eval">view_only_eval( ref_template_var, [HANDLE] )</A>
		<LI><A HREF="#get_assigned">get_assigned( ref_template_var, HANDLE )</A>
		<LI><A HREF="#get_assigned_unique">get_assigned_unique( ref_template_var, HANDLE )</A>
		<LI><A HREF="#internal_create_query">internal_create_query( $select_unique, $select_multiple, $select_relation, $query_plus)</A>
		<LI><A HREF="#details">INTERNAL DETAILS</A>
		<LI><A HREF="#another_example">ANOTHER EXAMPLE</a>
	</UL>
	<LI><A HREF="#DOCUMENTATION">DOCUMENTATION</A>
	<LI><A HREF="#VERSION">VERSION</A>
	<LI><A HREF="#HISTORY">HISTORY</A>
	<LI><A HREF="#AUTHOR">AUTHOR</A>
	<LI><A HREF="#SEEALSO">SEE ALSO</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="NAME">NAME</A></H1>
RFKmap 1.4 - A PHP extension for mapping database queries to templates
<P>


<HR>
<P>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<P>
<PRE>
    include( &quot;db_mysql.inc&quot; );
    include( &quot;class.FastTemplate.php3&quot; );
    include( &quot;class.rfkmap.php3&quot; );

    $tpl = new FastTemplate( &quot;/path/to/templates&quot; );
    $tpl-&gt;define( array ( &quot;main&quot;  =&gt; &quot;main.tpl&quot; ));

    $cBooks = new RFKmap( $tpl, &quot;Books&quot;,
                         array ( &quot;view_list&quot;  =&gt; &quot;booklist.tpl&quot;,
                                 &quot;view_item&quot;  =&gt; &quot;bookitem.tpl&quot;,
                                 &quot;view_only&quot;  =&gt; &quot;bookonly.tpl&quot;  ));

    $tpl->assign(TITLE_A, &quot;List of spanish's books.&quot;);
    $cBooks-&gt;view_list( $tpl, &quot;&quot;, &quot;spanish&quot;, &quot;&quot;, &quot; LIMIT 0,5&quot;  );
    $cBooks-&gt;view_list_parse( $tpl, &quot;CONTENT_A&quot; );

    $tpl->assign(TITLE_B, &quot;Details of a spanish book.&quot;);
    $cBooks-&gt;view_only( $tpl, &quot;2&quot;, &quot;spanish&quot; );
    $cBooks-&gt;view_only_parse( $tpl, &quot;CONTENT_B&quot; );

    $tpl-&gt;parse(CONTENT, &quot;main&quot;);
    $tpl-&gt;FastPrint(CONTENT);

</PRE>
<P>

<HR>
<P>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<B>What is a template?</B>
<P>A template is a text file with variables in it. When a template is parsed, the variables are interpolated to text. (The text can be a few bytes or a few hundred kilobytes.) Here is a simple template with one variable ('{NAME}'): 
<PRE>    Hello {NAME}.  How are you?</PRE>
<P>
<B>When are queries and templates useful? </B>
<P>
Templates are very useful for CGI programming, because adding HTML to your PHP code clutters your code and forces you to do any HTML modifications. By putting all of your HTML in seperate template files, you can let a graphic or interface designer change the look of your application without having to bug you, or let them muck around in your PHP code. 
<P>
Now, it's no necessary to make personalized PHP code for each dynamic's page to access a database queries. In a one sentence it's possible to do a complicated QUERY, mapping a SQL relationship from 1, 2 or 3 tables.
<P>
<B>Why use RFKmap?</B>
<P>
<B>Speed </B>
<P>RFKmap executes joins, queries and parses in one step with a single regular expression.
<P>
<B>Flexibility </B>
<P>The API is robust and flexible, and allows you to build very complex documents/interfaces from a database's queries. It is also completely written in PHP and work on Unix or NT. Also, it isn't restricted to building HTML documents -- it could be used to build any ascii based document (postscript, XML, email - anything). 
<P>These are outlined in detail in CORE METHODS below. 
<P>

<HR>
<P>
<H1><A NAME="COREMETHODS">CORE METHODS</A></H1>
<P>

<HR>
<P>
<H2><A NAME="newconstructor">new( ref_template_var, KEY, [array( key,value pairs)] )</A></H2>
<P>
This is a constructor's class method. Requires three parameters; <I>ref_template_var</I> to use the
global template variable; <I>KEY</I> which defines the map database object; and an array which it defines
template filenames.
<P>
When the <CODE>new()</CODE> method is complete, the configuration
has been readed, and the instance is ready to use.
Maps a template filename to a (usually simpler) identify name.
<P>
<PRE>
    $cBooks = new RFKmap( $tpl, &quot;Books&quot;,
                         array ( &quot;view_list&quot;  =&gt; &quot;booklist.tpl&quot;,
                                 &quot;view_item&quot;  =&gt; &quot;bookitem.tpl&quot;,
                                 &quot;view_only&quot;  =&gt; &quot;bookonly.tpl&quot;  ));
</PRE>
The tags <CODE>view_list</CODE>, <CODE>view_item</CODE> and <CODE>view_only</CODE> are the names that RFKmap will use to refer to the templates
about the especific KEY mapping. If it isn't redeclared, the system uses the templates-files defined in table <u>TemplatesDefinition</u>.
<P>
Note: This is a required step and all parametres are not empty.
<P>

<HR>
<P>
<H2><A NAME="view_only">view_only( ref_template_var, $select_unique, [$select_multiple], [$select_relation], [$query_plus] )</A></H2>
<P>
The method <CODE>view_only()</CODE> creates the query from the parameters and assigns ALL values for variables from fields of table's databases (complex queries) but only returns 1 or empty result.
In order for a variable in a template to be interpolated it must be assigned, but I use a timestamp flag
to prevent duplicated assigned variables.
<P>
<PRE>
    $cBooks = new RFKmap( $tpl, &quot;Books&quot;,
                         array ( &quot;view_list&quot;  =&gt; &quot;booklist.tpl&quot;,
                                 &quot;view_item&quot;  =&gt; &quot;bookitem.tpl&quot;,
                                 &quot;view_only&quot;  =&gt; &quot;bookonly.tpl&quot;  ));

    $cBooks-&gt;view_only( $tpl, &quot;2&quot;, &quot;spanish&quot; );
</PRE>
<P>
Definition RFKmap object:
<P>
<TABLE BORDER="1">
<TR>
	<TH>Table</TH>
	<TH>Field</TH>
	<TH>Value</TH>
	<TH>Description</TH>
</TR>
<TR>
	<TD>TypeDefinition</TD>
	<TD>guid</TD>
	<TD>1</TD>
	<TD>&nbsp;</TD>
</TR>
<TR>
	<TD>TypeDefinition</TD>
	<TD>typename</TD>
	<TD><B>Books</B></TD>
	<TD><I>key</I></TD>
</TR>
<TR>
	<TD>TableDefinition</TD>
	<TD>guid</TD>
	<TD>1</TD>
	<TD>&nbsp;</TD>
</TR>
<TR>
	<TD>TableDefinition</TD>
	<TD>unique_table</TD>
	<TD>BookUnique</TD>
	<TD><I>Name of table 1</I></TD>
</TR>
<TR>
	<TD>TableDefinition</TD>
	<TD>multiple_table</TD>
	<TD>BookLanguage</TD>
	<TD><I>Name of table 2</I></TD>
</TR>
<TR>
	<TD>TableDefinition</TD>
	<TD>relation_table</TD>
	<TD>&nbsp;</TD>
	<TD><I>Name of table 3</I></TD>
</TR>
<TR>
	<TD>TableDefinition</TD>
	<TD>unique_primary</TD>
	<TD>id_book</TD>
	<TD><I>select_unique parameter and field-identifier from table 1</I></TD>
</TR>
<TR>
	<TD>TableDefinition</TD>
	<TD>multiple_select</TD>
	<TD>language</TD>
	<TD><I>select_multiple parameter and field-identifier from table 2</I></TD>
</TR>
<TR>
	<TD>TableDefinition</TD>
	<TD>relation_select</TD>
	<TD>&nbsp;</TD>
	<TD><I>select_retaltion parameter and field-identifier from table 3</I></TD>
</TR>
</TABLE>
<P>
Mapping example:
<P>
<TABLE BORDER="1">
<TR>
	<TH>Key</TH>
	<TH>Table</TH>
	<TH>Fields</TH>
	<TH>RFKmap template variables</TH>
	<TH>&nbsp;</TH>
</TR>
<TR>
	<TD>Books</TD>
	<TD>BookUnique</TD>
	<TD>id_book</TD>
	<TD>BOOKS_BOOKUNIQUE_ID_BOOK</TD>
	<TD><I>select_unique identifier</I></TD>
</TR>
<TR>
	<TD>Books</TD>
	<TD>BookUnique</TD>
	<TD>author</TD>
	<TD>BOOKS_BOOKUNIQUE_AUTHOR</TD>
	<TD>&nbsp;</TD>
</TR>
<TR>
	<TD>...</TD>
	<TD>...</TD>
	<TD>...</TD>
	<TD>...</TD>
	<TD>&nbsp;</TD>
</TR>
<TR>
	<TD>Books</TD>
	<TD>BookLanguage</TD>
	<TD>id_book</TD>
	<TD>BOOKS_BOOKLANGUAGE_ID_BOOK</TD>
	<TD><I>select_unique identifier</I></TD>
</TR>
<TR>
	<TD>Books</TD>
	<TD>BookLanguage</TD>
	<TD>language</TD>
	<TD>BOOKS_BOOKLANGUAGE_ID_LANGUAGE</TD>
	<TD><I>select_multiple identifier</I></TD>
</TR>
<TR>
	<TD>Books</TD>
	<TD>BookLanguage</TD>
	<TD>title</TD>
	<TD>BOOKS_BOOKLANGUAGE_TITLE</TD>
	<TD>&nbsp;</TD>
</TR>
<TR>
	<TD>Books</TD>
	<TD>BookLanguage</TD>
	<TD>abstract</TD>
	<TD>BOOKS_BOOKLANGUAGE_ABSTRACT</TD>
	<TD>&nbsp;</TD>
</TR>
<TR>
	<TD>...</TD>
	<TD>...</TD>
	<TD>...</TD>
	<TD>...</TD>
	<TD>&nbsp;</TD>
</TR>
</TABLE>
<P>
Now, the RFKmap template variables contain the data from specific database's table.
<P>
Template's file example:
<P>
<TABLE BORDER="1">
<TR>
	<TH>Internal use</TH>
	<TH>Filename</TH>
	<TH>Contents</TH>
</TR>
<TR VALIGN="top">
	<TD><I>view_only</I></TD>
	<TD>bookonly.tpl</TD>
	<TD>
<PRE>
&lt;B&gt;{BOOKS_BOOKLANGUAGE_TITLE}&lt;/B&gt;
&lt;BR&gt;
{BOOKS_BOOKUNIQUE_DATEINS} - &lt;U&gt;{BOOKS_BOOKUNIQUE_AUTHOR}&lt;/U&gt;
&lt;BR&gt;
{BOOKS_BOOKLANGUAGE_ABSTRACT}
</PRE>
	</TD>
</TR>
</TABLE>
<P>
NOTE: The function <CODE>view_only()</CODE> returns 0 if not element perfoms the query or 1 if one element is reached.
<P>

<HR>
<P>
<H2><A NAME="view_only_parse">view_only_parse( ref_template_var, [HANDLE] )</A></H2>
<P>
The method <CODE>view_only_parse()</CODE> is the main function in RFKmap to print the result of query
invocated with the previous function <CODE>view_only()</CODE>.
<P>
<PRE>
    $result = $cNews->view_only( $tpl, "2", "spanish" );
    if ($result) {
        $cNews->view_only_parse( $tpl, "CONTENT_B" );
    }
</PRE>
NOTE: The HANDLE variable is optionally, and default uses the name of the RFKmap's key; at the example will be BOOKS
<P>
The append style allows you to append the parsed results to the target variable [HANDLE]. It uses the dot . philosophy from FastTemplate
to append the parsed results of this template to the returned results.
This is most useful when building dynamic zones that have multiples result queries - such as data from a 2 or more database query from RFKmap. 
<P>
<PRE>
    $result = $cTop->view_only( $tpl, "10", "lang_es", "section18" );
    if ($result) {
        $cTop->view_only_parse( $tpl, "CENTRAL_ZONE" );
    }
    $result = $cNews->view_only( $tpl, "15", "lang_es", "", "  AND u.Activate='Y' " );
    if ($result)
        $cNews->view_only_parse( $tpl, "CENTRAL_ZONE" );
    }
</PRE>
<P>

<HR>
<P>
<H2><A NAME="view_list">view_list( ref_template_var, $select_unique, [$select_multiple], [$select_relation], [$query_plus] )</A></H2>
<P>
The method <CODE>view_list()</CODE> creates the query from the parameters and assigns ALL values for variables from fields of table's databases (complex queries).
In order for a variable in a template to be interpolated it must be assigned, but I use a timestamp flag
to prevent duplicated assigned variables.
<P>
Using the template assigned at the <I>view_item</I> variable in the constructor, this functions maps all
results from the query to an internal variable named KEY<B>_LIST</B>, in the example will be BOOKS_LIST, which
it will be present in the <I>view_list</I> filename template assigned.
<P>
<PRE>
    $cBooks = new RFKmap( $tpl, &quot;Books&quot;,
                         array ( &quot;view_list&quot;  =&gt; &quot;booklist.tpl&quot;,
                                 &quot;view_item&quot;  =&gt; &quot;bookitem.tpl&quot;,
                                 &quot;view_only&quot;  =&gt; &quot;bookonly.tpl&quot;  ));

    $cBooks-&gt;view_list( $tpl, &quot;&quot;, &quot;spanish&quot;, &quot;&quot;, &quot; LIMIT 0,5&quot;  );
</PRE>
<P>
NOTE: This example searches 5 results from a query which <I>select_multiple</I> variable haves content '<B>spanish</B>'.
<P>
Template's file example:
<P>
<TABLE BORDER="1">
<TR>
	<TH>Internal use</TH>
	<TH>Filename</TH>
	<TH>Contents</TH>
</TR>
<TR VALIGN="top">
	<TD><I>view_list</I></TD>
	<TD>booklist.tpl</TD>
	<TD>
<PRE>
&lt;TABLE BORDER="1"&gt;
&lt;TR&gt;
    &lt;TH>Title&lt;/TH&gt;
    &lt;TH>Author&lt;/TH&gt;
    &lt;TH>Date&lt;/TH&gt;
    &lt;TH>Details&lt;/TH&gt;
&lt;/TR&gt;
{BOOKS_LIST}
&lt;/TABLE&gt;
</PRE>
	</TD>
</TR>
<TR VALIGN="top">
	<TD><I>view_item</I></TD>
	<TD>bookitem.tpl</TD>
	<TD>
<PRE>
&lt;TR&gt;
    &lt;TD&gt;{BOOKS_BOOKLANGUAGE_TITLE}&lt;/TD&gt;
    &lt;TD&gt;{BOOKS_BOOKUNIQUE_AUTHOR}&lt;/TD&gt;
    &lt;TD&gt;{BOOKS_BOOKUNIQUE_DATEINS}&lt;/TD&gt;
    &lt;TD&gt;&lt;a href="example.php3?id_book={BOOKS_BOOKUNIQUE_ID_BOOK}"&gt;Details&lt;/a&gt;&lt;/TD&gt;
&lt;/TR&gt;
</PRE>
	</TD>
</TR>
</TABLE>
<P>
<u>Interesting</u>: In release 1.4 added a internal sequential code using the next format KEY_<B>ID</B>.
Is useful in HTML forms to make arrays or similar.
<P>

<HR>
<P>
<H2><A NAME="view_list_parse">view_list_parse( ref_template_var, [HANDLE] )</A></H2>
<P>
The method <CODE>view_list_parse()</CODE> is the main function in RFKmap to obtain a list result
of query invocated with <CODE>view_list()</CODE> method.
<P>
<PRE>
    $cBooks = new RFKmap( $tpl, &quot;Books&quot;,
                         array ( &quot;view_list&quot;  =&gt; &quot;booklist.tpl&quot;,
                                 &quot;view_item&quot;  =&gt; &quot;bookitem.tpl&quot;,
                                 &quot;view_only&quot;  =&gt; &quot;bookonly.tpl&quot;  ));

    $result = $cBooks-&gt;view_list( $tpl, &quot;&quot;, &quot;spanish&quot;, &quot;&quot;, &quot; ORDER BY p.title GROUP BY r.id_sector &quot; );
    if ($result) {
        $cBooks-&gt;view_list_parse( $tpl, &quot;LIST_OF_BOOKS&quot; );
    } else {
        $tpl-&gt;assign( &quot;LIST_OF_BOOKS&quot;, &quot;No books in spanish language&quot; );
    }
</PRE>
<P>
The HANDLE variable is optionally, and default uses the name of the RFKmap's key; at the example should be BOOKS 
<P>
NOTE: The append style allows you to append the parsed results to the target variable [HANDLE]. 
<P>

<HR>
<P>
<H1><A NAME="OTHERMETHODS">OTHER METHODS</A></H1>
<P>

<HR>
<P>
<H2><A NAME="view_only_fetch">view_only_fetch( ref_template_var )</A></H2>
<P>
The method <CODE>view_only_fetch()</CODE> returns the raw data from a parsed handle.
<pre>
    $cBooks-&gt;view_only( $tpl, &quot;2&quot;, &quot;spanish&quot; );
    $content = $cBooks-&gt;view_only_fetch( $tpl );

    print $content;                       // print to STDOUT
    fwrite($fd, $content);                // write to filehandle
    $tpl->assign( &quot;CONTENT&quot;, $content );  // assign to another FastTemplate variable
</pre>
<P>

<HR>
<P>
<H2><A NAME="view_list_fetch">view_list_fetch( ref_template_var )</A></H2>
<P>
The method <CODE>view_list_fetch()</CODE> returns the raw data from a parsed handle.
<pre>
    $cBooks-&gt;view_list( $tpl, &quot;&quot;, &quot;spanish&quot; );
    $content = $cBooks-&gt;view_list_fetch( $tpl );

    print $content;                       // print to STDOUT
    fwrite($fd, $content);                // write to filehandle
    $tpl->assign( &quot;CONTENT&quot;, $content );  // assign to another FastTemplate variable
</pre>
<P>

<HR>
<P>
<H2><A NAME="view_only_eval">view_only_eval( ref_template_var, [HANDLE] )</A></H2>
<P>
The method <CODE>view_only_eval()</CODE> evaluate code stored in register's database.
<pre>
    $cPhp = new new RFKmap( $tpl, &quot;PHPCODE&quot; );
    $cPhp-&gt;view_only( $tpl, &quot;2&quot; );

    -- First option --
    $cPhp-&gt;view_only_eval( $tpl, &quot;DATE&quot; );

    -- Second option [in RFKmap 1.3 or earlier] --
    eval( $cPhp-&gt;view_only_fetch( $tpl ) );
    $tpl-&gt;assign( &quot;DATE&quot;, &quot;$output&quot; );
</pre>
<P>NOTE: View example2.php3 to see sample code about this new function.
<P>

<HR>
<P>
<H2><A NAME="get_assigned">get_assigned( ref_template_var, HANDLE )</A></H2>
<P>
This method will return the value of the variable that has been set via <CODE>view_only_fetch()</CODE> or <CODE>view_only_parse()</CODE>. This allows you
to easily pass variables around within functions by using the RFKmap class to handle parsed or assigned global variables. For example;
<P>
<PRE>
    $cBooks-&gt;view_only( $tpl, &quot;2&quot;, &quot;spanish&quot; );
    $cBooks-&gt;view_only_parse( $tpl );
    $author = $cBooks-&gt;get_assigned( $tpl, &quot;BOOKS_BOOKUNIQUE_AUTHOR&quot; );
</PRE>
<P>

<HR>
<P>
<H2><A NAME="get_assigned_unique">get_assigned_unique( ref_template_var, HANDLE )</A></H2>
<P>
The method <CODE>get_assigned_unique()</CODE> operates equal than <CODE>get_assigned()</CODE>, but it's useful when
you redefine, redeclare or recall one RFKmap object or function, and then uses the internal timestamp (GUID
unique by object and parsed variables) to select an assigned global variable.
<P>

<HR>
<P>
<H2><A NAME="internal_create_query">internal_create_query( $select_unique, $select_multiple, $select_relation, $query_plus)</A></H2>
<P>
The method <CODE>internal_create_query()</CODE> must not been called from you PHP code page. It's only for internal procedure.
<P>

<HR>
<P>
<H2><A NAME="details">INTERNAL DETAILS</A></H2>
<P>
The RFKmap classes has been tested using Apache 1.3.9 webserver, MySQL 3.22 database engine, FastTemplate 1.1.0, PHPLIB 6.2, and PHP 3.0.9 over Linux and Windows systems.
<p>
<b>Using database access</b>
<p>
Edit <code>class.rfkmap.php3</code> and modify the class <code>DBCORE()</code> and put your database connectivity values (host, database, user and password)
<p>
In MYSQL exists the function <i>SHOW FIELDS FROM tablename</i> which it's necessary to run the RFKmap engine.
If you are using another database engine search a similar method to obtain the name of the fields from table's databases
and send me your results.
<P>
This version of RFKmap support a maximun of three relationated tables (see example 3) in an object, which a common field in all tables (3 tables)
<p>
<table border="1">
<tr>
	<th>&nbsp;</th>
	<th>1st table</th>
	<th>2nd table</th>
	<th>3rd table</th>
</tr>
<tr>
	<td><b>internal table</b></td>
	<td>unique_table</td>
	<td>multiple_table</td>
	<td>relation_table</td>
</tr>
<tr>
	<td><b>using in <i>query plus</i></b></td>
	<td>u.</td>
	<td>p.</td>
	<td>r.</td>
</tr>
</table>
<p>

<HR>
<P>
<H2><A NAME="another_example">ANOTHER EXAMPLE</A></H2>
<p>
Example 1: One table
<p>
RFKmap key: ObjCompany<br>
<table border="1">
<tr>
	<th>Tablename</th>
	<th>unique_select name</th>
	<th>other fields</th>
</tr>
<tr>
	<td>Company</td>
	<td>id_company</td>
	<td><i>name, address, phone, ...</i></td>
</tr>
</table>
<p>
Example 2: Two tables
<p>
RFKmap key: ObjEmployeed<br>
<table border="1">
<tr>
	<th>Tablename</th>
	<th>unique_select name</th>
	<th>multiple_select name</th>
	<th>other fields</th>
</tr>
<tr>
	<td>Company</td>
	<td>id_company</td>
	<td>&nbsp;</td>
	<td><i>name, address, phone, ...</i></td>
</tr>
<tr>
	<td>Employeed</td>
	<td>id_company</td>
	<td>id_employeed</td>
	<td><i>surname, activity, email, phone, ...</i></td>
</tr>
</table>
<p>
Example 3: Three tables
<P>
RFKmap key: ObjSector<br>
<table border="1">
<tr>
	<th>Tablename</th>
	<th>unique_select name</th>
	<th>multiple_select name</th>
	<th>relation_select name</th>
	<th>other fields</th>
</tr>
<tr>
	<td>Company</td>
	<td>id_company</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	<td><i>name, address, phone, ...</i></td>
</tr>
<tr>
	<td>Activity</td>
	<td>id_company</td>
	<td>id_activity</td>
	<td>&nbsp;</td>
	<td><i>activity, ...</i></td>
</tr>
<tr>
	<td>Sector</td>
	<td>id_company</td>
	<td>&nbsp;</td>
	<td>id_sector</td>
	<td><i>sector_name, region, ...</i></td>
</tr>
</table>
<p>
RFKmap example:
<pre>
    $cCompanyOnly = new RFKmap( $tpl, &quot;ObjCompany&quot;,
                         array ( &quot;view_list&quot;  =&gt; &quot;companyA-list.tpl&quot;,
                                 &quot;view_item&quot;  =&gt; &quot;companyA-item.tpl&quot;,
                                 &quot;view_only&quot;  =&gt; &quot;companyA-only.tpl&quot;  ));
    $cEmployeed = new RFKmap( $tpl, &quot;ObjEmployeed&quot;,
                         array ( &quot;view_list&quot;  =&gt; &quot;employeed-list.tpl&quot;,
                                 &quot;view_item&quot;  =&gt; &quot;employeed-item.tpl&quot;,
                                 &quot;view_only&quot;  =&gt; &quot;employeed-only.tpl&quot;  ));
    $cSector = new RFKmap( $tpl, &quot;ObjSector&quot;,
                         array ( &quot;view_list&quot;  =&gt; &quot;none.tpl&quot;,
                                 &quot;view_item&quot;  =&gt; &quot;none.tpl&quot;,
                                 &quot;view_only&quot;  =&gt; &quot;sector-only.tpl&quot;  ));

    $cCompanyOnly-&gt;view_list( $tpl, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot; ORDER BY u.name&quot;  );
    $result = $cCompanyOnly-&gt;view_list_parse( $tpl, &quot;CONTENT&quot; );
    $tpl-&gt;assign(TOTAL_COMPANY, &quot;There are $result companys.&quot;);

    $cSector-&gt;view_only( $tpl, &quot;&quot;, &quot;Engineering&quot;, &quot;Manufacturer&quot;, &quot; GROUP BY r.id_company &quot;  );
    $id_activity = $cSector-&gt;get_assigned( $tpl, &quot;OBJSECTOR_ACTIVITY_ID_ACTIVITY&quot; );

    $cEmployeed-&gt;view_list( $tpl, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot; AND p.id_activity = '$id_activity' ORDER BY u.name&quot;  );
    $cEmployeed-&gt;view_list_parse( $tpl, &quot;CONTENT&quot; );
	
    $cEmployeed-&gt;view_only( $tpl, &quot;15&quot;, &quot;Administrative&quot;, &quot;&quot;, &quot; AND p.id_activity = '$id_activity'&quot;  );
    $result = $cEmployeed-&gt;view_only_parse( $tpl, &quot;CONTENT&quot; );	
</pre>
<p>

<HR>
<P>
<H1><A NAME="DOCUMENTATION">DOCUMENTATION</A></H1>
<P>
You're reading it.
<P>

<HR>
<P>
<H1><A NAME="VERSION">VERSION</A></H1>
<P>
Revision 1.4 - Aug 19, 2001 &copy RFK Solutions &lt;<A HREF="mailto:hide@address.com">hide@address.com</A>&gt;
<P>


<HR>
<P>
<H1><A NAME="HISTORY">HISTORY</A></H1>
<P>
<P>1.4 Added support for predefined templates in database table, and added <CODE>view_only_eval()</CODE> for evaluating php code. Version released Aug 19, 2001.
<P>1.3 Added <CODE>get_assign()</CODE> and <CODE>get_assign_unique()</CODE> methods to obtain internal assigned variables. Version released Jul 07, 2001.
<P>1.2 Added <CODE>view_only_fetch()</CODE> method and <CODE>view_list_fetch()</CODE> method to obtain a PHP variable from an executed query-mapped. Version not released. 
<P>1.1 Added a new constructor <CODE>class DBCORE()</CODE> from support DB_Sql module. Version not released. 
<P>1.0 Initial public release
<P>


<HR>
<P>
<H1><A NAME="AUTHOR">AUTHOR</A></H1>
CopyRight (c) 2001 RFK Solutions, <A HREF="mailto:hide@address.com">hide@address.com</A>. All Rights Reserved.
<P>This program is free software; you can redistribute it and/or modify it under the GNU General Artistic License, with the following stipulations; 
<P>Changes or modifications must retain these Copyright statements. Changes or modifications <B>must</B> be submitted to the author.
<P>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Artistic License for more details. This software is distributed AS-IS. 
<P>Address Bug Reports or Comments to RFK Solutions, <A HREF="mailto:hide@address.com">hide@address.com</A>. 
<P>The latest version of this class should be available from the following locations: 
<P><A HREF="http://rfkmap.sourceforge.net">http://rfkmap.sourceforge.net</A>
<P>
<HR>
<P>
<H1><A NAME="SEEALSO">SEE ALSO</A></H1>
DB_Sql module at PHPLIB classes, available in <A HREF="http://phplib.netuse.de/">http://phplib.netuse.de/</A>
<P>FastTemplate PHP3 module, available from CDI - <A HREF="http://www.thewebmasters.net/">http://www.thewebmasters.net</A>
<P>

</DL>
</BODY>
</HTML>
Return current item: RFKmap