As an alternative to dynamically creating/managing directories and 
copying code into them, here is what I have done in the past.  Each time 
a "sweepstake" is added, modified or deleted, we recreated a .htaccess 
file in the root directory that sets up redirects for each sweepstake.  
So  /sweepstakeName redirects to 
/sweepstakes/index.cfm?sweepstakes_ID=45 or 
/sweepstakes/index.cfm?sweepstakes_Title=SweepstakeName

If you want the user to stay at /sweepstakename all the time and not be 
redirected, you could write out mod_rewrite lines instead.

I'm not saying thats a better way of doing it, just another way.  I 
prefer to have as few pieces of code-generated-code as possible.

Also you might want to think of having an "active" flag, so a sweepstake 
could still exist and be viewed in the admin side, without actually 
giving users access to it.

-Ryan

Bruce Sorge wrote:
> I have been tasked by one of my customers to create an on-line sweepstakes.
> They want to be able to create a sweepstakes dynamically (title of the
> sweepstakes, questions, answers and control types).
> Also, they want to be able to run one or more sweepstakes at a time, but
> they do not want a link to all of the sweepstakes currently running from the
> home page. Rather they would want the customer to go to
> www.sitename.com/sweepstakesname.
>
> So here is what I have devised. If anyone has a better idea, I would love to
> hear it.
>
> DB Tables:
>
> Sweepstakes
> sweepstakes_ID int
> Sweepstakes_Title varchar
>
> Questions
> Question_ID int
> Question text
> Sweepstakes_ID
>
> Answers
> Answer_ID int
> Question_ID int
> Control_Type varchar
> Control_Name varchar
> Answer varchar
>
> CustomerAnswers
> Sweepstakes_ID int
> Customer_ID int
> Question_ID int
> Answer text
>
> I have an admin page that flows like this:
>
> Admin enters the name of the new sweepstakes. Then they go to the question
> section. They select the sweepstakes that they want to add questions to,
> enter in the question, then they go to a page that has them enter answers
> and control types (radio, checkbox, text, textarea). Once they are done
> entering the answers for that question, they go back to a new question and
> then do it all over again. As far as creating a new folder for each .cfm
> page for the sweepstakes, I thought that when they enter the sweepstakes
> title, they can enter a name for the directory, then I create a directory
> with CFDIRECTORY tag, and use CFFILE to copy the .cfm files from a main
> directory to the new directory. The main sweepstakes page is index.cfm so
> that should work. Then, when they are done, I can show them a page that has
> the URL of the sweepstakes they currently created, like
> www.sitename.com/newcoolsweepstakes. They can then copy and paste it to
> marketing email to customers. So what do you all think of this? Is this a
> descent approach or is there a better way to do it?
>
> Thanks,
>
>   



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:270243
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to