Guest User

Untitled

a guest
Jun 22nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. ## index.cfm
  2. <html>
  3. <head><title>Hello World</title></head>
  4. <body>
  5. <cfform name="jokes">
  6. <center>
  7. <table border="0" cellspacing="20">
  8. <tr>
  9. <td>
  10. <cf_grid type="drunk" pagesize="20" width="600">
  11. </td>
  12. <td>
  13. <cf_grid type="stoner" pagesize="20" width="600">
  14. </td>
  15. </tr>
  16. </table>
  17. </center>
  18. </cfform>
  19. </body>
  20. </html>
  21.  
  22.  
  23. ## grid.cfm
  24. <cfset type = attributes.type>
  25. <cfif type eq ''>
  26. You must supply a type
  27. <cfelse>
  28. <cfgrid
  29. format="html"
  30. name="grid_#type#jokes"
  31. pagesize=#attributes.pagesize#
  32. selectmode="row"
  33. bind="cfc:v7db.getJokes({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},'#type#')"
  34. >
  35. <cfgridcolumn name="ID" display="No">
  36. <cfgridcolumn name="Line" header="#type# Jokes" width="#attributes.width#">
  37. </cfgrid>
  38. </cfif>
  39.  
  40.  
  41. ## v7db.cfc
  42. <cfcomponent>
  43. <cffunction name="getJokes" access="remote" returntype="struct">
  44. <cfargument name="page" required="yes">
  45. <cfargument name="pagesize" required="yes">
  46. <cfargument name="gridsortcolumn" required="yes">
  47. <cfargument name="gridsortdirection" required="yes">
  48. <cfargument name="type" required="yes">
  49.  
  50. <cfset typename=#type#>
  51. <cfif typename eq 'stoner'>
  52. <cfset typename="stoned">
  53. </cfif>
  54.  
  55. <cfquery name="jokes" datasource="orion_viper7">
  56. SELECT `ID`, concat('You know you\'re #typename# when ', `Line`) as Line FROM `#type#jokes`
  57. <cfif gridsortcolumn neq ''>
  58. ORDER BY #gridsortcolumn# #gridsortdirection#
  59. </cfif>
  60. </cfquery>
  61.  
  62. <cfreturn queryConvertForGrid(jokes, page, pagesize) >
  63. </cffunction>
  64. </cfcomponent>
Add Comment
Please, Sign In to add comment