Skip to main content
August 19, 2009
Question

cfsavecontent and query output

  • August 19, 2009
  • 1 reply
  • 3874 views

Can cfsavecontent be used multiple times with the same variable name on one page?  I have a cfoutput query with the cfsavecontent within it.  Since it cache's the content, will it recreate the content each time?  I'm saving it to a file so that it can be a link.  The data isn't coming out correct which is why I'm asking.  I'm trying to create Events with a vCalendar link.  I output the events in a list with the link to the vcs file.  Is there a way to clear this variable each time?  Any other way to go about this?

This code is sitting within a cfoutput query tag, so it loops multiple times.

<cfsavecontent variable="vCalendar.content">
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:#vcalendar.startdate#T#vcalendar.starttime#Z
DTEND:#vcalendar.enddate#T#vcalendar.endtime#Z
TRANSP:1
SUMMARY:#vCalendar.Summary#
DESCRIPTION:#vCalendar.Description#
PRIORITY:#vCalendar.Priority#
END:VEVENT
END:VCALENDAR
</cfsavecontent>


<cffile action="WRITE" file="#ExpandPath(vCalendar.FileName)#" output="#Trim(vCalendar.content)#">

Thanks!

    This topic has been closed for replies.

    1 reply

    Inspiring
    August 19, 2009

    What do you mean "The data isn't coming out correct"? It would help if you explained the actual results versus what you expect the results to be ..

    August 19, 2009

    The dates and times are off.  I'm trying to find a pattern of why they're off, but I'm not seeing one.  When I output the results on the screen, they are right.  When they are saved to the cfsavecontent and opened in Outlook, they are incorrect (randomly).

    For example, a date should be 09/07/2009, instead it will output to the cfsavecontent as Wed 11/11/2009.  The time should be 09:30 AM, it will be something random like 4:30 PM.

    The first output is correct, the rest are not.

    If interested, you can view it at:

    http://www.salemelementarypta.com

    Inspiring
    August 19, 2009

    Assuming the underlying values here are formatted correctly, perhaps there is a conflict between your query and cfcontent variable name? If I am reading the code correctly, "vcalendar" is a query and used as a variable? That seems a little odd ..

    Have you tried it with a different variable name:

    <cfsavecontent variable="differentNameHere"