2 Replies Latest reply on Nov 17, 2006 2:38 AM by Species_Evolution

    Cffile Issues


      I'm having a rather annoying problem - I'm trying to create a file through cffile - the contents need to be dynamic so there is a loop and a few conditions attached. I can't seem to get the CF running inside the cffile tag and for it to write the results as plain text inside that file.

      This code needs to be processed and then written to the file in it's altered state.

      Any advice greatly appreciated.

        • 1. Re: Cffile Issues
          Level 7
          var MENU_ITEMS = [<br />
          <cfloop query='read_navigation'>
          <cfif sublevel EQ '0'>
          ['#read_navigation.title#', '#read_navigation.link#',
          #read_navigation.lastitem# EQ '1'>],<br /></cfif><br />
             ['#read_navigation.title#', '#read_navigation.link#',
          {'tw':'_self'}],<br /><cfif #read_navigation.lastitem# EQ '1'>],<br

          You can't do an assignment like this. I'm not even sure where to start
          on this. What you need to do is build a string and then write that
          string to a file with the cffile attribute. I would look into the
          <cfsavecontent...> tag and|or string concactination.

          Save Content Example
          <cfsaveContent variable="Menu_Items">
          TEXT and CFML that produces Text

          String Concactination Example
          Menu_Items = "Text "
          Menu_Items = Menu_Items & "and CFML "
          Menu_Items = Menu_Items & "that produces Text " &
          • 2. Re: Cffile Issues
            Species_Evolution Level 1

            <cfsavecontent> and a bit of fiddling with the layout solved the problem.

            Thanks Ian.