Return to Snippet

Revision: 44281
at April 9, 2011 04:15 by jdevcl


Updated Code
<!---
	CFWheels Controller/Action Base File Creator

	1) Set variable "outputFolderPath" to your "output" folder
	2) Set variable "controllers" by starting a new controller with @ 
		and then the list of actions.
			EX:
				@ControllerOne,index,add,edit,delete
				@ControllerTwo,index,report
				@ControllerThree,action1
--->

<!--- User Defined Variables --->
<cfset outputFolderPath = "C:\wwwroot\">
<cfset controllers = "@Home,Index,Search
		      @StudentProfile,Index,ViewFinalSubmissionDetails,SendMsgToStudent
 		      @Communications,Index,ViewSingleCommunication
                      @Admin,Index,Programs,Deadlines,FCLA_Transfers,SiteContent,IndexProcess,ProgramsProcess,DeadlinesProcess,FCLA_TransfersProcess,SiteContentProcess
             	      @Templates,Index,Add,Edit,Delete,IndexProcess,AddProcess,EditProcess,DeleteProcess
            	      @Reports,Index">

<!--- Loop thru controller "packages" (Controller+Actions)--->
<cfloop list="#controllers#" delimiters="@" index="oneSet">
	<cfset counter = 0>
    <cfset finalOutput = "<cfcomponent extends=""Controller"">
	<cffunction name=""init"">
		<!--- Code --->
    </cffunction>">
    <!--- Loop thru actions of one controller--->
	<cfloop list="#oneSet#" delimiters="," index="oneSetDetails" >
    	<cfif counter eq 0>
             <cfset fileName = trim(oneSetDetails)&".cfm">
             <cfoutput><h1>Controller: #fileName#</h1></cfoutput>        
        <cfelse>
            <cfset finalOutput &= "
	<cffunction name="""&trim(oneSetDetails)&""">
		<!--- Code --->
    </cffunction>">
        	<cfoutput><h2>Action: #oneSetDetails#</h2></cfoutput>                
        </cfif>
        <cfset counter++>
    </cfloop>
    <cfset finalOutput &= "
</cfcomponent>">
    <hr/>
    <cfset filePath = outputFolderPath & fileName>
	<cffile action="write" file="#filePath#" output="#finalOutput#">
</cfloop>

Revision: 44280
at April 9, 2011 00:38 by jdevcl


Initial Code
<!---
	CFWheels Controller/Action Base File Creator

	1) Set variable "outputFolderPath" to your "output" folder
	2) Set variable "controllers" by starting a new controller with @ 
		and then the list of actions.
			EX:
				@ControllerOne,index,add,edit,delete
				@ControllerTwo,index,report
				@ControllerThree,action1
--->

<!--- User Defined Variables --->
<cfset outputFolderPath = "C:\wwwroot\">
<cfset controllers = "@Home,Index,Search
					  @StudentProfile,Index,ViewFinalSubmissionDetails,SendMsgToStudent
					  @Communications,Index,ViewSingleCommunication
					  @Admin,Index,Programs,Deadlines,FCLA_Transfers,SiteContent,IndexProcess,ProgramsProcess,DeadlinesProcess,FCLA_TransfersProcess,SiteContentProcess
					  @Templates,Index,Add,Edit,Delete,IndexProcess,AddProcess,EditProcess,DeleteProcess
					  @Reports,Index">

<!--- Loop thru controller "packages" (Controller+Actions)--->
<cfloop list="#controllers#" delimiters="@" index="oneSet">
	<cfset counter = 0>
    <cfset finalOutput = "<cfcomponent extends=""Controller"">
	<cffunction name=""init"">
		<!--- Code --->
    </cffunction>">
    <!--- Loop thru actions of one controller--->
	<cfloop list="#oneSet#" delimiters="," index="oneSetDetails" >
    	<cfif counter eq 0>
	        <cfset fileName = trim(oneSetDetails)&".cfm">
			<cfoutput><h1>Controller: #fileName#</h1></cfoutput>        
        <cfelse>
			<cfset finalOutput &= "
	<cffunction name="""&trim(oneSetDetails)&""">
		<!--- Code --->
    </cffunction>">
			<cfoutput><h2>Action: #oneSetDetails#</h2></cfoutput>                
        </cfif>
        <cfset counter++>
    </cfloop>
    <cfset finalOutput &= "
</cfcomponent>">
    <hr/>
    <cfset filePath = outputFolderPath & fileName>
	<cffile action="write" file="#filePath#" output="#finalOutput#">
</cfloop>

Initial URL


Initial Description


Initial Title
CFWheels Controller/Action Base File Creator

Initial Tags


Initial Language
ColdFusion