Frameless Frames in CF

Frameless Frames in CF


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>



All ColdFusion Tutorials By Author: D Evans
  • Checking for submitted form fields
    This sets all of the submitted form fields and values into a list then loops through the list of fields and values.
    Author: D Evans
    Views: 15,866
    Posted Date: Friday, December 13, 2002
  • Dynamic Image Gallery
    You will be shown how to display the images in the desired number of columns and desired number of records per page with minimal coding. When the thumbnail image is clicked on it will open another window with the large image and image description under it.
    Author: D Evans
    Views: 23,223
    Posted Date: Sunday, December 8, 2002
  • Frameless Frames in CF
    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.
    Author: D Evans
    Views: 16,093
    Posted Date: Wednesday, December 11, 2002
  • Make a generic email form processor
    This code will process any form submitted and email the submitted form fields excluding the submit, the redirect, the hidden, and the required fields; to the designated recipient.
    Author: D Evans
    Views: 17,678
    Posted Date: Friday, December 13, 2002