So for a couple of days i've been thinking ;How cn i get the code to output nicely on screen' and so i asked Ray Camden to see how he does it only to find out that it is a render method in BlogCFC.
Nice one Ray.
Here is my test:
<cffunction name="insertCat" access="public" output="false" returntype="numeric" displayname="i add an category" hint="i upload an category to the cats table"> <cfargument name="datasourceName" required="yes" type="string" hint="datasource name"> <cfargument name="catName" required="yes" type="string" hint="categoryName"> <cfset var="" qinsertcategory=""> <cfset var="" errormsg=""> <cftransaction action="begin"> <cftry> <cfquery name="qInsertCategory" datasource="#arguments.datasourceName#"> insert INTO tblCats ( catName ) values ( '#arguments.catName#' ) select @@Identity AS CatID<br /><br /></cfquery><cfcatch type="any"><cftransaction action="rollback"><cfsavecontent variable="ErrorMsg"><cfdump var="#cfcatch#"></cfdump><cfmodule template="../ErrorTemplate.cfm" errortitle="Error inserting category" debug="<p>#ErrorMsg#</p>" errormessage="Error<P>Diagnostics:<br>#cfcatch.message#<br>#cfcatch.detail#</P><p>#ErrorMsg#</p>" sendmail="1"><cfabort></cfabort></cfmodule><cftransaction action="commit"></cftransaction><cfreturn qinsertcategory.catid=""></cfreturn></cfsavecontent></cftransaction></cfcatch></cftry></cftransaction></cfset></cfset></cfargument></cfargument></cffunction>
it's worth noting that if you (like me) are using a WYSIWYG editor (
check out this post) then you will need to code into the source view to add the <code> </code> tags.
There are no comments for this entry.
[Add Comment]