Matt BurelloMatthew Burello
 
 
Frameless Frames in ColdFusion
The appeal of frames and the continued use is -- to leave one constant item on a part of the page.
However clever, they are a pain to code, setting targets and defining the columns and then there that scroll bar thing.

Here is an easy way to create the illusion of frames on your page.

For this example I created a table with 3 items.
Artid
Art_title
Art_text 

Set a default parameter .

<cfparam name=”url.artid” default=”0”>

Make a table in your cfm page with 1 row and 2 columns.

Write a query and select the items you want to appear in the left side of the table.

<cfquery name="getart" datasource="frames">
    select artid,art_title
    from frames
</cfquery>



4 screen shot of the tables and results

Notice the left side does not change , but the information on the right does



I used the html list function to format the titles in a list. 
Write an anchor tag referring back to this same page ( I called this one frameless_frames.cfm) 
And add the artid to the anchor tag. (?artid=#artid#) close the anchor and you left side list is dynamically created.


<ul>
   <cfoutput query="getart">
      <li><a href="frameless_frames.cfm?artid=#artid#">#Art_title#</a></li>
   </cfoutput>
</ul>
</td>


In our second column of the table:
Write an if statement that checks to see if there is a url.art id present, and it is not the default url.artid we set in the cfparam tag at the top.
If it is not:
Write a query to select the atrid, art_title, art_text from the database where the artid is equal to the artid in the url.

<cfif isdefined("url.artid") and #Url.artid #is not 0>
    <cfquery name="getart1" datasource="frames">
           select *
           from frames
           where artid=#url.artid#
     </cfquery>

     Then output the query results into our right side.

     <cfoutput query="getart1">
       <strong>#art_title#</strong><br><br>
       #art_text#
      </cfoutput>

     Add the else statement so the page right side is not empty when it is first opened 

<cfelse>

   <!--- enter default message here --->
   
This message would appear as the default message on this page.
   <!--- end enter default message here --->

</cfif>

Latest Innovations