Skip to main content
Participant
May 2, 2008
Question

CFHTTP help

  • May 2, 2008
  • 2 replies
  • 485 views
I am having a little trouble I just started using Cold Fusion a week ago, and I'm going through my companies pages and doing a little updating and such.

One of my little projects is to work on our admin page. It's a page filled with links. I've updated the code on these to keep a count of how many "active" items are on that page. (site pages that are missing items or need to be updated)

anyway I have this count being made everytime the page is run, then it displays the count on the more options page. The problem I have is I need to find a way to up this count outside of the individual pages. I thought of using CFHTTP to just run each page, however I can't seem to get it run the page. It doesn't error out it just doesn't do anything.

what would be the proper way to do this with CFHTTP or is there a better way you can think of?

Thanks
Kevin
This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
May 3, 2008
There seems to be a contradiction in what you want to achieve. The count functionality is in the application file. Coldfusion includes the application file when it runs a page. how then do you expect to run a page without the count functionality?

NCX001Author
Participant
May 7, 2008
I am making a count in each individual page that records what it new on that page. (or what is missing, or whatever depending on what that page does) This count is made when the page is run and saved to a field on a table. On the admin links page (the one that displays the links to pages that I am changing) has links and the count. So the count funtionality is only be run on the pages I'm making it for, that's why I don't want it in the application file. What I'm wanting is to ad another link or button to the admin links page that will refresh this count, the only way I can think about doing that is creating a page that will run each link on the admin links page. Does this make sense? Any help or advice will be great, like I said I'm very new to cold fusion and programming in general.
BKBK
Community Expert
Community Expert
May 10, 2008
NCX001 wrote:
I am making a count in each individual page that records what it new on that page. (or what is missing, or whatever depending on what that page does) This count is made when the page is run and saved to a field on a table. On the admin links page (the one that displays the links to pages that I am changing) has links and the count. So the count funtionality is only be run on the pages I'm making it for, that's why I don't want it in the application file.

I understand.

What I'm wanting is to ad another link or button to the admin links page that will refresh this count, the only way I can think about doing that is creating a page that will run each link on the admin links page. Does this make sense?

Yes, it makes sense. When you're at headquarters(admin), all kinds of things happen in the branches, departments and offices(pages). You want to be able to synchronize and keep track.

I would create a special page which has the sole task of synchronizing and keeping track of the counts. It should only receive instructions from the admin page.

Call the special page update.cfm. There should be just one link or button in the whole application that takes you to update.cfm, and it should be on the admin page. One should be able to send instructions. For example, you may want to send instructions about the pages to be run, their order of execution, the data the pages need, and so on.

Now, since update.cfm is going to initiate a hundred or more page requests, it would make sense for this to happen asynchronously in a separate thread. The page cannot sit waiting for such a huge job to finish. Thus, when update.cfm starts, a separate thread is initiated to run the 100+ requests and control is quickly returned back to update.cfm. Meanwhile, the updating thread continues in the background.

A solution is now obvious: a CFML gateway. The functionality of running the 100+ pages is in the onIncomingMessage method of the listener CFC. The file update.cfm contains the sendGatewayMessage method that sends the details to the gateway. You could put all those detais in a text file updateConfig.txt which is read in update.cfm by means of cffile.



Inspiring
May 2, 2008
I'd be doing something in the application.cfc/cfm file.
NCX001Author
Participant
May 2, 2008
Way too much stuff to be run that often. The refresh link needs to run through 110+ pages, and some of these run some pretty big queries. But thanks though I didn't think about that.