Scorpio Functions: GetComponentMetaData

Word Count: 149
I would like to start talking about some of the new functions in Scorpio. The first one we are going to discuss is the getComponentMetaData function. This function will get meta data about the component for ColdFusion component or Interface. The function takes a path parameter and can me a dot notation or absolute path the component. I know most of you are going to quickly point out that you could do this in the past using the getMetaData function. There is a big difference for me though. The getMetadata accepted a component that has already been instantiated. When using the new getComponentMetaData function you do not need to create an instance of the component, it can read this information directly from the component. In my quick example I am referencing a component named art in the same directory.
<cfset meta = getComponentMetaData("art")>
<cfdump var="#meta#">

Tip of The Day using CFWindow

Word Count: 787

Another great tag in ColdFusion 8 AKA Scorpio is the cfwindow tag. This tag create a popup window in the browser without creating a separate browser instance. While I thought this was a great Idea I wasn't quite sure where I would use this. Once I got to thinking I quickly realized that it would be much easier figuring out where I wouldn't use it. This tag is very useful in so many ways and I would like to point out my first idea. This is just a quick example with a little code. If we were going to create an actual tip of the day application we could go much more in depth.

Let us say for example that every time someone visits my blog I want to display a tip of the day to them. Even better you could read in some type of session variable for the users settings or place a cookie on their machine. The session variable would tell us if we should display the tip of the day or not. If so we simply build our new tip of the day window. First off this is another tag that can take attributes as a structure and this seems to be better code to me so I am sticking with it. Here were are just defining the basic properties of our new window. For more information about all of the windows attributes please see the cfml reference.

<cfset win = structNew()>
   <cfset win.name = "totd">
   <cfset win.title = "Tip Of The Day">
   <cfset win.center = true>
   <cfset win.closable = true>
   <cfset win.draggable = true>
   <cfset win.initShow = true>
   <cfset win.modal = true>
   <cfset win.width = 600>
   <cfset win.height = 300>
   <cfset win.resizable = true>
Once we have our window ready all that is left to do is build the window and display our tip. My tip here is static but we could easily have a database full of tips and have a function that randomly returns to us a tip.
<!--- session variable for tip of the day --->
   <cfif session.showTOTD>
   <cfwindow attributeCollection="#win#">
   
      <h4>Did You Know?</h4>
      <p>Here are a couple tips when navigating around my website.</p>
      
      <ul>
         <li>You can use the search box to the right to search all archived articles</li>
         <li>By clicking on a subject under archives by subject you can see a listing of all articles by subject</li>
         <li>You can email me using danvega@gmail.com</li>
         <li>I use gtalk so you can contact me there as well</li>
         <li>Lebron James Is King James to you!</li>
      </ul>
   </cfwindow>
   </cfif>

If you would like to check out the demo I built you can visit the link below. Here is the final code I used.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
   <title>CFWindow / Tip Of The Day</title>
   <style>
   body,li,p {
      font-family:Arial,sans-serif;
      font-size:12px;
   }
   </style>
</head>

<body>

   <img src="images/website.jpg">

   <!--- show tip of the day --->
   <cfset session.showTOTD = true>
   <!--- just in case we forgot to set it --->
   <cfparam name="session.showTOTD" default="false"/>
   
   <cfset win = structNew()>
   <cfset win.name = "totd">
   <cfset win.title = "Tip Of The Day">
   <cfset win.center = true>
   <cfset win.closable = true>
   <cfset win.draggable = true>
   <cfset win.initShow = true>
   <cfset win.modal = true>
   <cfset win.width = 600>
   <cfset win.height = 300>
   <cfset win.resizable = true>
   
   <!--- session variable for tip of the day --->
   <cfif session.showTOTD>
   <cfwindow attributeCollection="#win#">
   
      <h4>Did You Know?</h4>
      <p>Here are a couple tips when navigating around my website.</p>
      
      <ul>
         <li>You can use the search box to the right to search all archived articles</li>
         <li>By clicking on a subject under archives by subject you can see a listing of all articles by subject</li>
         <li>You can email me using danvega@gmail.com</li>
         <li>I use gtalk so you can contact me there as well</li>
         <li>Lebron James Is King James to you!</li>
      </ul>
   </cfwindow>
   </cfif>
   
</body>
</html>


http://h127408.cf8beta.com/ajax/tipoftheday.cfm

ColdFusion 8 Additional Installers Links

Word Count: 72

If you have logged in to the new administrator in ColdFusion 8 you will notice that the additional installers links for both the ColdFusion Report builder and eclipse extensions are not working. If you want to download them you can use the following link until the project is out of beta.

http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5Fadobecf8%5Fbeta

Copyright © 2007 Dan Vega | BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.