Under the WWW root directory of your CXP application, you will need to create a new folder named Helpers.
For example, below is the CXP source code for an application that lists customers from a database. The application is in a file named CUSTOMER.CXP under C:\wamp\www\ds\customers (I am using Apache). If I were using IIS then it would be in C:\inetpub\wwwroot\ds\customers.
I created a folder named C:\wamp\www\ds\customers\Helpers and I copied DCLIPX.LIB and DCLIPX.DLL into the Helper folder.
I then created a file named C:\wamp\www\ds\customers\application.config. It has the following content:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<info author = "Roger Donnay"
version = "1.0"
copyright= "Copyright (C) $YEAR$ Donnay Software Designs. All rights reserved"
title = "Customers"
header = "Sample program for listing Sample Customer Database" />
<!-- List the libraries to be linked with the CXP page -->
<helpers
lib="dclipx.lib"
/>
Your #include files must reside in the INCLUDE folder of the CXP runtime, i.e. C:\cxp20\include or
C:\Program Files (x86)\Alaska Software\cxp20\include.
To run this CXP page and view it's output in your browser click here:
http://bb.donnay-software.com/ds/custom ... tomers.cxp
Code: Select all
<%#Code locality="page-global"%>
<%
/// This code is injected at the beginning of the intermediate
/// code generated by the CXC Builder. This is the perfect place
/// for the statics, classes, functions and procedures being
/// used in your CXP page.
///
#include "dcdialog.ch"
#include "dchtml.ch"
%>
<%#Code locality="page-render"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
</head>
<body>
<!--- Page content goes here --->
<h1>My Customer List</h1>
<h3>Rendering as simple text</h3>
<pre>
<%
USE (::PhysicalPath+"customer.dbf") ;
INDEX (::PhysicalPath+"\customer.cdx");
VIA "FOXCDX"
oRecord := CUSTOMER->(DC_DbRecord():new())
DO WHILE !CUSTOMER->(Eof())
CUSTOMER->(DC_DbScatter(oRecord))
? oRecord:bill_name, oRecord:bill_strt, oRecord:bill_city, oRecord:bill_state
CUSTOMER->(dbSkip())
ENDDO
%>
</pre>
<h3>Rendering in an HTML Table</h3>
<table border=1>
@CUSTOMER->(dbGoTop())
@DO WHILE !CUSTOMER->(Eof())
@CUSTOMER->(DC_DbScatter(oRecord))
<tr>
<td>@(oRecord:bill_name)</td>
<td>@(oRecord:bill_strt)</td>
<td>@(oRecord:bill_city)</td>
<td>@(oRecord:bill_state)</td>
</tr>
</tr>
@CUSTOMER->(dbSkip())
@ENDDO
</table>
<h3>Rendering with DCREAD HTML</h3>
<%
DCTABLE OBJECT oTable ROWS CUSTOMER->(RecCount()) COLUMNS 4 ;
BGCOLOR '#33CCFF' ;
BORDER 5 ;
BORDERCOLORLIGHT '#FFFFFF' ;
BORDERCOLORDARK '#FFFFFF' ;
CELLPADDING 5 ;
CELLSPACING 0
CUSTOMER->(dbGoTop())
nRow := 1
DO WHILE !CUSTOMER->(Eof())
@ nRow,1 DCHTML TEXT CUSTOMER->bill_name PARENT oTable
@ nRow,2 DCHTML TEXT CUSTOMER->bill_strt PARENT oTable
@ nRow,3 DCHTML TEXT CUSTOMER->bill_city PARENT oTable
@ nRow,4 DCHTML TEXT CUSTOMER->bill_state PARENT oTable
CUSTOMER->(dbSkip())
nRow++
ENDDO
DCREAD HTML TO cHtml
? cHtml
CUSTOMER->(dbCloseArea())
%>
</body>
</html>