Chapter 18: Building Custom CFAPI Tags
You are not responsible for freeing the memory allocated for the returned string set (it
will be freed automatically by ColdFusion after the request is completed).
Example
The following example retrieves the list of attributes and then iterates over the list,
writing each attribute and its value back to the user.
LPCSTR lpszName, lpszValue ;
CCFXStringSet* pAttribs = pRequest->GetAttributeList() ;
int nNumAttribs = pAttribs->GetCount() ;
for( int i=1; i<=nNumAttribs; i++ )
{
}
CCFXRequest::GetCustomData
LPVOID CCFXRequest::GetCustomData(void)
Gets the custom (tag specific) data for the request. This member is typically used from
within subroutines of your tag implementation to extract tag specific data from within
the request.
Returns a pointer to the custom data or returns
during this request using CCFXRequest::SetCustomData.
Example
The following example retrieves a pointer to a request specific data structure of
hypothetical type MYTAGDATA:
void DoSomeGruntWork( CCFXRequest* pRequest )
{
}
CCFXRequest::GetQuery
CCFXQuery* CCFXRequest::GetQuery(void)
Retrieves the query that was passed to the tag. To pass a query to a custom tag, you use
the
QUERY
lpszName = pAttribs->GetString( i ) ;
lpszValue = pRequest->GetAttribute( lpszName ) ;
pRequest->Write( lpszName ) ;
pRequest->Write( " = " ) ;
pRequest->Write( lpszValue ) ;
pRequest->Write( "<BR>" ) ;
MYTAGDATA* pTagData =
(MYTAGDATA*)pRequest->GetCustomData() ;
... remainder of procedure ...
attribute. This attribute should be set to the name of an existing query
if no custom data has been set
NULL
303
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?