School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,370 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,455 people online right now. Registration is fast and FREE... Join Now!




Opening up a .cfm file and ending the first 2 lines of code.

 

Opening up a .cfm file and ending the first 2 lines of code.

xheartonfire43x

25 Jun, 2009 - 07:11 AM
Post #1

D.I.C Regular
***

Joined: 22 Dec, 2008
Posts: 260



Thanked: 2 times
My Contributions
I have a website administrator application that my company built that when you add a page to the subnavigation it creates the .cfm page and adds the file to a database. In each file I get the content of that page from the database based on that pages category id and id. so in the function that creates the page I copy over a template page that I have, and at the top of the page it sets paramaters for the catid and id
CODE

<cfparam name="catid" default="x">
<cfparam name="id" default="x">


That is exactly how the template looks with the reast of the code for the page following. What I need to do is open the file and replace the x with the actual catid and id that gets passed through arguments.
Function to create the page:
CODE

            //Set folder as catID #Arguments.catid#
            folder = "catID" & ARGUMENTS.catid;
            //Get the actual folder based on the original folder variable
            if (folder EQ "catID1"){
                folder = catID1;
            }
            else if (folder EQ "catID2"){
                folder = catID2;
            }
            else if (folder EQ "catID3"){
                folder = catID3;
            }
            //Set the absolute path to the folder
            fullfolder = expandpath(folder);
            //Set the folder and file
            fill = newstring & ".cfm";
            folderfile = fullfolder & file;
            folderfiletemp = fullfolder & "template.cfm";
            //Copy the template file
            fileCopy(folderfiletemp,folderfile);
            //Open the file to edit the catid and id
            fileOpen(folderfile,"append");
        </cfscript>


That is just part of it. I don't think anyone will need anything else.

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 09:10PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month