>
> Firstly am i right in thinking that the display code for custom rules
> is contained solely within the execute function in the
> ruleMyCustomType.cfc? Or can it be stored elsewhere? Are the display
> files in webskin/myCustomType/ simply to provide a displaymethod
> listing or can they be pulled in in some way?
The execute function in a rule provides the means of pulling in the data
required for display. The files in the webskin folder for your custom type
provide the templates of how your data is displayed. You can just pass the
stuff to be displayed straight into the invocation array (see the text
rule), but displayMethods/webskins are much more flexible.
The update method in a rule contains a form that allows you to select the
criteria or records that will be displayed in a container. One of the
fields in this form is a drop down for the displayMethod. This field is
populated using displayMethodSelector widget :
<cfimport taglib="/farcry/farcry_core/tags/widgets/" prefix="widgets">
<widgets:displayMethodSelector typeName="yourCustomType"
prefix="fileprefix">
You give the tag your type name and the prefix of the files you'd like to
use for display in a container for this rule.
Farcry's cms elements tends to use two prefixes displayPage and
displayTeaser. Page being a full page display and Teaser being teasers for
a record, but you could use "rumpelstiltskin" if you wished. In your rule
you need a displaymethod property to store this in.
When the form is submitted you just need to put form.displayMethod into
stObj.displayMethod when you save your rule object data.
Before I talk about the execute function just a quick mention on webskin
templates
In the top of your webskin template you have a comment that looks like this
:
<!--- @@displayname: your webskin template title --->
The bit after displayname: is what will appear in the displayMethod
selector, so make sure its meaningful for your users.
In the execute function you do all the processing you need to prepare your
data for display. This might be as simple as :
<cfset stObj = getData(arguments.ObjectID)>
which returns the objectID of a selected record from your custom data type,
the type name and the displayMethod that was selected in the update method
for the given container.
After this you simply add this information to the end of the invocation
array and farcry handles the rest when it displays the page. Adding this
information to the invocation array is pretty straight forward.
<cfscript>
locals.stInvoke = structNew();
locals.stInvoke.objectID = stObj.DataObjectID;
locals.stInvoke.typename = application.types.mydatatype.typePath;
locals.stInvoke.method = stObj.displayMethod;
arrayAppend(request.aInvocations,locals.stInvoke);
</cfscript>
DataObjectID is just my name for the property in your rule where the
ObjectID from you custom data type is stored.
When your page is displayed the invocation engine runs through the
containers picking up the rules assigned to them and executing them. Once
all the rules have been executed the invocation engine goes through the
aInvocations variable and gets the data for the ObjectID/datatype and uses
the displayMethod to include the appropriate webskin and display each
record.
In your execute, if you have a query that gets a number of record from your
custom datatype table according to parameters selected in your rule form
just loop through the details adding them to the invocation array.
~takes deep breath~ I hope that makes some sense!
Secondly when i attempted to create links within my rules display code
> they led to a page with the message 'unknown type'. I was using the
> variable application.url.conjurer setup. Do I need to create my own
> rulespecific code? I notice that the relevant records in the refobjects
> table stored the rule name rather than the type. is this correct?
I'm not sure what you're upto here, so I'm not sure what to say....
Sorry If these are obvious qus but i need to get up to speed on some of
> this stuff fairly sharpish.
>
Sorry its not been the swiftest response - its taken me about an hour of
research and checking on my son and then coming back to this and trying to
write it in English as much as I can. ;)
I hope it helps
Regards
Stephen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"farcry-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/farcry-dev?hl=en
-~----------~----~----~----~------~----~------~--~---