Building A Plugin

Building A Plugin

rave7 plugins can be "plugged" into any page of the website and generally should be self contained meaning both the interface and processing of form and URL variables will happen all in the same plugin. The plugin can call other plugins to streamline your code.

1. All URL’s should include the DocID and point to index.cfm NOT the plugin directly.

<a href="index.cfm?DocID=<cfoutput>#DocID#</cfoutput>&your_paremter=value">Title

2. All form actions should be set to index.cfm NOT the plugin itself and incluide the DocID variable

<form action=index.cfm method=post>

<input type=hidden name=DocID value=”<cfoutput>#DocID#</cfoutput>”>
Your other form variables

</form>

You can add any other required form or URL parameters to your links and forms.

Technically speaking, if you do not include the DocID variable with your links and forms, the CMS will try to use a client variable to return the user to the same page as your plugin.

The CMS passes the DocID variable into every page.

When you click a link or submit a form, the CMS will come back to the same form, where your program plugged into, and you can process the URL or form variables.

3. <cFQUERY

Use it like this:

<cfquery datasource="#DSN#">
Your SQL...
</cfquery>

You don't have to worry about the name of the datasource, or the setup of it. The CMS passes the DSN variable into every page.

Simple Example

<cfif isdefined("form.submit")>
Your first name is: <cfoutput>#form.first#</cfoutput>
<cfelse>

<form method="post" action="index.cfm">
Enter your first name
<input name="first" size=20">
<input type="submit" name="submit" value="Continue"> </form>
</cfif>

you could also process the form submission by including the processing in a separate plugin as follows:

<cfif isdefined("form.submit")>
<cfinclude template="plg_update.cfm">
<cfelse>

<form method="post" action="index.cfm">
Enter your first name
<input name="first" size=20">
<input type="submit" name="submit" value="Continue">
</form>

</cfif>