• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

read and write a cf page?

I have a dynamic  .cfm page, that displays data from DB based on the ID of a product passed in the URL at the top of the page, very simple stuff i.e. product-page.cfm?prodID=1

Now I have another application which I want to get and read the product-page.cfm page, then  pass a URL i.e  product-page.cfm?prodID=2, save the outputted file, rename it. i.e. I now have a static file called some-product.cfm which is the same as if I have done product-page.cfm?prodID=2?

Does any of that make sense? Well if it does here is tricky part, I still want the new page recreated to be a cf one. i.e its dynamic still not a static output.

Before I did all this with cfhttp read then write the new file, only this method created a static page which cannot process cf after.

so now have this code (below) which works, but the new page I have to still pass a url to get it to do anything

If none of that make sense sorry


    <cffile
     action = "read"
      file = "#productPageTemplate#"
      variable = "productPageContent"
       >
   

      <cffile action="write"
                        output="#productPageContent#?prodId=#prodId#"
                        file="#productPageLocation##productPageName##productExt#"
                        nameconflict="overwrite">
0
pigmentarts
Asked:
pigmentarts
1 Solution
 
Scott BennettManager TechnologyCommented:
Try reading the original file then adding a cfparam tag to the output of the new file like:

  <cffile
     action = "read"
      file = "#productPageTemplate#"
      variable = "productPageContent"
       >
   

      <cffile action="write"
                        output="<cfparam name=""url.prodID"" default=""2"">#productPageContent#"
                        file="#productPageLocation##productPageName##productExt#"
                        nameconflict="overwrite">
0
 
pigmentartsAuthor Commented:
SBennett, yes if what your saying is correct i mean i could fix the url.prodid at write, for ever and ever. cool. :) i try this out tomorrow and let you know. thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now