Skip to main content
Known Participant
April 20, 2014
Answered

how can i generate a new static link/file?

  • April 20, 2014
  • 2 replies
  • 955 views

Im trying to figure out how to approch a problem. what I want to do is generate a new file/link, maybe using 'cffile' or any other way.

Right now i have cse_newsletter.cfm , that looks like this(kind of)

<html>

.......

<cfquery>

select ....

</cfquery>

select ....

<cfquery>

</cfquery>

.......

<cfoutput>

      <h1>Starburst Star Award</h1>

     <h3>Winner: Department- #highest_dept_name_average#</h3>

     <h3>Average:  #hihest_dept_average# </h3>

     <h4>Runner-up: Department- #highest_dept_name_runnerup# </h4>

     <h4> Average: #highest_dept_name_average_runnerup# </h4>

  </cfoutput>

</html>

the query works and give me the correct output i want.(rigth now i use cfshedule to run it, but everytime i will run it will overwrite the old data with the new) what it does it gives me the data of the past month.

so every tiime it runs it should give me the data from the past month.

I would like to make it that everytime i click on a submit(maybe there is a better way to do it without submit) it will give me a static txt/link that has the data.

i know that with cffile="write" it can give me a txt file(and this file can be overwritten) , but i would preffer if is easier to just me a link on cse_newsletter.cfm that will output/display what is on the body right now in cse_newsletter.

please give me any advice/suggestion, maybe a article i can read online (havent found anything that can help me)

this right her is the cfshedule, right now is on update, so obvioulsy it wont work with update, but i dont think with what i want i can accomplish with cffile "write"

<cfschedule action = "update"

    task = "TaskName"

    operation = "HTTPRequest"

    url = "cse_execoffice_newsletter.cfm"

    startDate = "04/18/14"

    startTime = "11:19 AM"

    interval = "3600"

    resolveURL = "Yes"

>

thanks

This topic has been closed for replies.
Correct answer tribule

I mean that your cse_newsletter.cfm template can be designed to accept parameters to show a newsletter for a certain month and year. If it accepts URL parameters then you can create a link to it like this:

http://mydomain.com/cse_newsletter.cfm?month=1&year=2014

And, if parameters are not passed, you could make it show the user a list of months and years (via form controls e.g. selection list) so that they can select the month and year that they require. That's how I would design it anyway. Unless your data is stored somewhere in a database, your template will only ever work for one scenario (the last month), and that is a big limitation since people cannot then see past newsletters. You may not need to write files to disk etc, since the template just needs to show the correct newsletter. You can create whatever link to the newsletter you require once it has been designed to accept month and year parameters (which are in turn fed to your CFQUERY tags to get the data).

2 replies

Legend
April 20, 2014

@no_name_123:

"please give me any advice/suggestion, maybe a article i can read online (havent found anything that can help me)"

Change your approach to the problem. First of all make your script create the data you require and then write it into a database for the appropriate month/year. Then you can just make cse_newsletter.cfm ask the user for a date/month/year and then generate the report (defaulting it to the current month/year perhaps.) That way, the end-user can request a newsletter for any valid month/year that exists in the database. If you want, you can also  make the script accept URL parameters e.g. cse_newsletter.cfm?month=1&year=2014 and serve up the newsletter that way too. It will be a nice little project, good luck.

Known Participant
April 21, 2014

what do you mean by

"can just make cse_newsletter.cfm ask the user for a date/month/year"?

tribuleCorrect answer
Legend
April 21, 2014

I mean that your cse_newsletter.cfm template can be designed to accept parameters to show a newsletter for a certain month and year. If it accepts URL parameters then you can create a link to it like this:

http://mydomain.com/cse_newsletter.cfm?month=1&year=2014

And, if parameters are not passed, you could make it show the user a list of months and years (via form controls e.g. selection list) so that they can select the month and year that they require. That's how I would design it anyway. Unless your data is stored somewhere in a database, your template will only ever work for one scenario (the last month), and that is a big limitation since people cannot then see past newsletters. You may not need to write files to disk etc, since the template just needs to show the correct newsletter. You can create whatever link to the newsletter you require once it has been designed to accept month and year parameters (which are in turn fed to your CFQUERY tags to get the data).

BKBK
Community Expert
Community Expert
April 20, 2014

You could show a bit more respect to the forum. You are fast giving me the impression you want to come here with a list of requirements and have fellow developers do your work for you.

I have given suggestions in a number of your threads. There was always silence whenever it reached the point where you needed to give more information. Here are recent examples:

http://forums.adobe.com/message/6303098#6303098

http://forums.adobe.com/message/6303093#6303093

http://forums.adobe.com/message/6299165#6299165

http://forums.adobe.com/message/6295752#6295752

http://forums.adobe.com/message/6292024#6292024

http://forums.adobe.com/message/6288569#6288569

You don't even have to thank colleagues. However, you owe it to the forum to simply acknowledge whether or not a suggestion has helped.