>> GreenByte.info By Nick Tong (quiksilv) | Supported by: TalkWebSolutions.co.uk

BlogCFC Coldfusion code output

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="&lt;p&gt;#ErrorMsg#&lt;/p&gt;" errormessage="Error&lt;P&gt;Diagnostics:&lt;br&gt;#cfcatch.message#&lt;br&gt;#cfcatch.detail#&lt;/P&gt;&lt;p&gt;#ErrorMsg#&lt;/p&gt;" 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.


 
Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.5.1.