Ok for some reason all of this seems overly complicated to me. And
while I see what Jake's doing, I built all of my rules according to
the dev guide so there's no HTML in them whatsoever, just in the
displayTeaser/Page files and I don't think going back and changing all
of them now is a very viable option. I guess my question is why can't
I just insert a new key into the stObj struct in the rules file? Using
structInsert() or something like the following? I've tried
structInsert() and the following to no avail (stObj.rowStyle does not
exist error) and it's baffling me as to why...

This is my execute function in my rules.cfc (no HTML whatsoever,
follows the dev guide):

<cffunction name="execute" hint="This is the execute function."
output="false" returntype="void" access="public">
  <cfargument name="objectID" required="false" type="uuid" default="">
  <cfargument name="dsn" required="false" type="string"
default="#application.dsn#">
  <cfargument name="dbowner" required="false" type="string"
default="#application.dbowner#">
  <cfargument name="style" required="false" type="string" default="">

  <cfset var stObj = getData(arguments.objectid)>
  <cfset var qGet = "">
  <cfset var stInvoke = structNew()>
  <!--- get items that have status equal to current view mode --->
  <!--- Make sure to change the table name --->
  <cfquery datasource="#arguments.dsn#" name="qGet">
    SELECT *
    FROM #arguments.dbowner#chapels
    WHERE STATUS IN
('#ListChangeDelims(request.mode.lValidStatus,"','",",")#')
  </cfquery>
  <cfif len(trim(stObj.intro)) AND qGet.recordcount>
    <cfset arrayAppend(request.aInvocations,stObj.intro)>
  </cfif>
  <cfloop query="qGet">
    <cfset stInvoke = structNew()>
    <cfset stInvoke.objectID = qGet.objectID>
    <!--- Make sure to change the packagePath precursor --->
    <cfset stInvoke.typename =
application.stCoapi.chapels.packagePath>
    <cfset stInvoke.method = stObj.displayMethod>
    <cfset arrayAppend(request.aInvocations,stInvoke)>
  </cfloop>
</cffunction>

It would seem to me that just making the following change should work:

  <cfset stObj.rowStyle = "off" />
  <cfloop query="qGet">
    <cfset stInvoke = structNew()>
    <cfset stInvoke.objectID = qGet.objectID>
    <!--- Make sure to change the packagePath precursor --->
    <cfset stInvoke.typename =
application.stCoapi.chapels.packagePath>
    <cfset stInvoke.method = stObj.displayMethod>
    <cfset stInvoke.rowStyle = stObj.rowStyle> /* NOT SURE IF THIS IS
EVEN NEEDED */
    <cfset arrayAppend(request.aInvocations,stInvoke)>
    <cfif stObj.rowStyle EQ "off">
      <cfset stObj.rowStyle = "on" />
    <cfelse>
      <cfset stObj.rowStyle = "on" />
    </cfif>
  </cfloop>

Or am I overly simplifying something that isn't this simple? Why
wouldn't it just be adding a key to the existing stObj struct?

On Nov 20, 6:46 pm, Jeff Coughlin <[EMAIL PROTECTED]> wrote:
> I do a similar thing as to what Blair suggests (btw Blair, is stParam,  
> (no "s")).  However, I don't suggest talking directly to the arguments  
> scope from within a webskin file (reasons for which I hope are  
> obvious :) ).
>
> I've been meaning to add a feature request to the bug tracker (a  
> simple one) where getView() methods will also return stObj.stParam.  
> This is a simple implementation by just adding the line <cfset  
> stObj.stParam = arguments.stParam /> before including the webskin  
> within the getView() method.
>
> In the meantime, I have a workaround that you can use.  It's a bit  
> nasty though because you have to put this at the top of every webskin  
> file that might use stParam.
>
> <!--- Begin code --->
> <cfparam name="arguments" default="#structNew()#" type="struct" />
> <cfparam name="stParam" default="#structNew()#" type="struct" />
> <cfif not structKeyExists(stObj, "stParam")>
>    <cfset stObj.stParam = duplicate(arguments.stParam) />
> </cfif>
> <!--- End code --->
>
> After that I declare any special variables that might exist from the  
> stParam structure:
> <cfparam name="stObj.stParam.myVar" default="" />
>
> Hope that helps,
>
> --
> Jeff Coughlin
> Web Application Developerhttp://jeffcoughlin.com
>
> On Nov 20, 2007, at 5:45 PM, Blair McKenzie wrote:
>
>
>
> > Depends on where you're using the teaser. But in general you can do  
> > this by passing extra variables into a template with the stParams  
> > struct argument on the skin:view tag or the getView function. From  
> > within the teaser you can access these variables via  
> > arguments.stParams.
>
> > Blair
>
> > On Nov 21, 2007 5:16 AM, tilespace wrote:
>
> > Hello... Me again :)
> > Has anyone been able to do alternaterowcolors for custom types using
> > teaser pages?
>
> > From what I can tell, the rule calls the teaser page for every item in
> > the DB so it's just getting onerowat a time. I'm not going to be
> > able to determine what thatrowcolor should be since they're not
> > called at once, correct? Is there some way, or some hidden FC feature
> > that I don't know about, to do this?
>
> > Does that make sense what I'm trying to do?- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to