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

Welcome to Dream.In.Code
Become an Expert!

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




Cold fusion easy?

 

Cold fusion easy?, I need help with learning this launguage

horsemeguy

29 Apr, 2009 - 04:40 PM
Post #1

New D.I.C Head
*

Joined: 20 Apr, 2009
Posts: 5

I want to learn cold fusion or C++, maybee both. Please give me some exaple codes that I can study, please dont give me links or advice to other places on this or any other site. I just want to get the basics. blink.gif Pleaes help me. crazy.gif

User is offlineProfile CardPM
+Quote Post


xheartonfire43x

RE: Cold Fusion Easy?

30 Apr, 2009 - 05:30 AM
Post #2

D.I.C Regular
***

Joined: 22 Dec, 2008
Posts: 260



Thanked: 2 times
My Contributions
QUOTE(horsemeguy @ 29 Apr, 2009 - 04:40 PM) *

I want to learn cold fusion or C++, maybee both. Please give me some exaple codes that I can study, please dont give me links or advice to other places on this or any other site. I just want to get the basics. blink.gif Pleaes help me. crazy.gif


If you want to learn ColdFusion I know you don't want links but just check out the LiveDocs on adobe for it. But here are some Code Snippets for you.

This is a complete page for a site.
application.cfm
CODE

<cfapplication sessionmanagement="yes" sessiontimeout="#createTimeSpan(0,1,0,0)#">

<!---Retrive Scripts Folder--->
<cfajaximport scriptsrc="http://********.net/scripts/">

<!---Error Handling --->
<Cfset errors = "off">

<!---Website Variables--->
<cfset siteURL = "http://********.com/">

<!---Datasource Variables--->
<cfset mydatasource = "dlong">
<cfset myusername = "sa">
<cfset mypassword = "*******">

<!---Email Variables--->
<cfset EmailContact = "dlong@********.com">
<cfset EmailSubject = "Website Contact Form">
<cfset ReturnTo = "/thankyou.cfm">
<cfset sitetitle = "David Long">

<!---File Storage Variables--->
<cfset localpath = "C:\ColdFusion8\webroot\urbansite\">
<cfset localFilePath = "C:\ColdFusion8\webroot\urbansite\">
<cfset urlpath = "http://dlong.********.com/Files/">

<cfif errors eq "on">
<cferror type="exception" template="404.cfm" exception="any">
<cferror type="request" template="offline.cfm" exception="any">
<cfelse>
</cfif>


index.cfm
CODE

<!--- Set the parameter CatID and ID defaults --->
<cfparam name="catid" default="1">
<cfparam name="id" default="1">

<!---Include the SQL page that will get the subnav and content--->
<cfinvoke component="/common/incl_sql" method="subnav" returnvariable="getsub">
    <cfinvokeargument name="mydatasource" value="#mydatasource#">
    <cfinvokeargument name="myusername" value="#myusername#">
    <cfinvokeargument name="mypassword" value="#mypassword#">
    <cfinvokeargument name="catid" value="#catid#">
    <cfinvokeargument name="id" value="#id#">
</cfinvoke>
<cfinvoke component="/common/incl_sql" method="content" returnvariable="getContent">
    <cfinvokeargument name="catid" value="#catid#">
    <cfinvokeargument name="id" value="#id#">
    <cfinvokeargument name="mydatasource" value="#mydatasource#">
    <cfinvokeargument name="myusername" value="#myusername#">
    <cfinvokeargument name="mypassword" value="#mypassword#">
</cfinvoke>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<cfoutput>
<title>#sitetitle# : #getContent.title#</title>
<meta http-equiv="description" content="#getContent.meta_description#">
<meta http-equiv="keywords" content="#getContent.meta_keywords#">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</cfoutput>

<link href="/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<!--- Include the Admin Application page --->
<cfinclude template="/admin/incl_application.cfm">

<!--- Begin Body --->
<table cellpadding="0" cellspacing="0" border="0" width="703">
    <tr><td><cfinclude template="/common/incl_header.cfm"></td></tr>
    <tr><td><cfinclude template="/common/mainbody.cfm"></td></tr>
    <tr><td><cfinclude template="/common/incl_footer.cfm"></td></tr>
</table>

</body>
</html>


incl_sql.cfc
CODE

<cfcomponent>

<cffunction name="subnav" output="no" access="public" returntype="query">
    <cfargument name="mydatasource" type="string">
    <cfargument name="myusername" type="string">
    <cfargument name="mypassword" type="string">
    <cfargument name="catid" default="1">
    <cfargument name="id" default="1">

    <cfset var getsub = "">
    
    <cfquery name="getsub" datasource="#arguments.mydatasource#" username="#arguments.myusername#" password="#arguments.mypassword#">
        SELECT *
        FROM nav
        WHERE catid = <cfqueryparam value="#arguments.catid#" cfsqltype="cf_sql_integer">
            AND display = 'Y'
    </cfquery>

    <cfreturn getsub />
</cffunction>

<cffunction name="content" output="no" access="public" returntype="query">
    <cfargument name="mydatasource" type="string">
    <cfargument name="myusername" type="string">
    <cfargument name="mypassword" type="string">
    <cfargument name="catid" default="1">
    <cfargument name="id" default="1">

    <cfset var getcontent = "">
    
    <cfquery name="getcontent" datasource="#arguments.mydatasource#" username="#arguments.myusername#" password="#arguments.mypassword#">
        SELECT *
        FROM sitecontent
        WHERE cat = <cfqueryparam value="#arguments.catid#" cfsqltype="cf_sql_integer">
            AND id = <cfqueryparam value="#arguments.id#" cfsqltype="cf_sql_integer">
    </cfquery>

    <cfreturn getContent />
</cffunction>


</cfcomponent>


incl_header.cfm
CODE

<table width="703" height="453" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="10"><img src="/Images/Urban_01.gif" width="703" height="59" alt=""></td>
    </tr>
    <tr>
        <td colspan="4" rowspan="2"><img src="/Images/Urban_02.gif" width="271" height="214" alt=""></td>
        <td colspan="3"><a href="/index.cfm"><img src="/Images/Urban_03.gif" width="112" height="47" border="0" alt=""></a></td>
        <td colspan="2"><a href="/index.cfm?id=5&catid=1"><img src="/Images/Urban_04.gif" width="93" height="47" border="0" alt=""></a></td>
        <td rowspan="2"><img src="/Images/Urban_05.gif" width="227" height="214" alt=""></td>
    </tr>
    <tr>
        <td colspan="5"><img src="/Images/Urban_06.gif" width="205" height="167" alt=""></td>
    </tr>
    <tr>
        <td><a href="/index.cfm"><img src="/Images/Home_<cfif catid eq 1>on<cfelse>off</cfif>.gif" width="64" height="26" border="0" alt="Home"></a></td>
        <td><a href="/about/index.cfm"><img src="/Images/about_<cfif catid eq 2>on<cfelse>off</cfif>.gif" width="65" height="26" border="0" alt="About Us"></a></td>
        <td><a href="/photos/index.cfm"><img src="/Images/photos_<cfif catid eq 3>on<cfelse>off</cfif>.gif" width="62" height="26" border="0" alt="Photos"></a></td>
        <td colspan="2"><a href="/index.cfm?id=4&catid=1"><img src="/Images/contact_<cfif catid eq 1 & id eq 4>on<cfelse>off</cfif>.gif" width="98" height="26" border="0" alt="Contact Us"></a></td>
        <td colspan="5" valign="top"><img src="/Images/Urban_11.gif" width="414" height="26" alt=""></td>
    </tr>
    <tr>
        <td colspan="10" align="right" valign="top" height="52"><img src="/Images/Urban_13.gif" width="399" height="52" alt=""></td>
    </tr>
    <tr>
        <td colspan="8"><!---Add Flash Title Here (size can be up to 467x101--->
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="467" height="101">
                <param name="movie" value="../Flash/subtitle.swf">
                <param name="quality" value="high">
              <param name="flashvars" value="SubText=<cfoutput>#getcontent.title#</cfoutput>">
                <embed src="../Flash/subtitle.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="467" height="101"></embed>
            </object>

        </td>
        <td colspan="2"><img src="/Images/Urban_15.gif" width="236" height="101" alt=""></td>
    </tr>
    <tr>
        <td><img src="/Images/spacer.gif" width="64" height="1" alt=""></td>
        <td><img src="/Images/spacer.gif" width="65" height="1" alt=""></td>
        <td><img src="/Images/spacer.gif" width="62" height="1" alt=""></td>
        <td><img src="/Images/spacer.gif" width="80" height="1" alt=""></td>
        <td><img src="/Images/spacer.gif" width="18" height="1" alt=""></td>
        <td><img src="/Images/spacer.gif" width="15" height="1" alt=""></td>
        <td><img src="/Images/spacer.gif" width="79" height="1" alt=""></td>
        <td><img src="/Images/spacer.gif" width="84" height="1" alt=""></td>
        <td><img src="/Images/spacer.gif" width="9" height="1" alt=""></td>
        <td><img src="/Images/spacer.gif" width="227" height="1" alt=""></td>
    </tr>
</table>


incl_subnav.cfm
CODE

<table cellpadding="0" cellspacing="0" border="0" width="200">
    <cfif getsub.Recordcount gt 0>
        <tr><td><span class="subdash">--------------------------------------</span></td></tr>
        <cfloop query="getsub"><cfoutput>
            <tr>
                <td class="subcell">
                    <cfif getSub.URLLink gt " ">
                        <a href="#getSub.URLLink#" class="sublink"><img src="/Images/subnav_bird.gif" border="0">&nbsp;&nbsp;#getSub.navtitle#</a>
                    <cfelse>
                        <a href="index.cfm?id=#getSub.id#&amp;catid=#getSub.catid#" class="sublink"><img src="/Images/subnav_bird.gif" border="0"> &nbsp; &nbsp; #getSub.navtitle#</a>
                    </cfif>
                </td>
            </tr>
            <tr><td><span class="subdash">--------------------------------------</span></td></tr>
        </cfoutput></cfloop>
    </cfif>
</table>


mainbody.cfm
CODE

<p />
<table cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td width="200" style="padding-right:10px; "><cfinclude template="/common/incl_subnav.cfm"></td>
        <td style="border-left-width:1px; border-left-style:solid; border-left-color:#999999; ">&nbsp;</td>
        <td><cfinclude template="/common/incl_content.cfm"></td>
    </tr>    
</table>


incl_content.cfm
CODE

<p>
    <cfoutput><span class="content">#getContent.content#</span></cfoutput>
</p>
<cfif id eq 4>
    <p><cfinclude template="/admin/common/incl_contact.cfm"></p>
<cfelseif id eq 5>
    <p><cfinclude template="/admin/common/incl_sitemap.cfm"></p>
</cfif>



That is almost an entire website page. All I have to do is change the id and catid in the index.cfm page and I can pull almost any of my pages from the DB
User is offlineProfile CardPM
+Quote Post

ComboAlex

RE: Cold Fusion Easy?

6 Aug, 2009 - 12:18 PM
Post #3

New D.I.C Head
*

Joined: 31 Jul, 2009
Posts: 25


My Contributions
QUOTE(horsemeguy @ 29 Apr, 2009 - 04:40 PM) *

I want to learn cold fusion or C++, maybee both. Please give me some exaple codes that I can study, please dont give me links or advice to other places on this or any other site. I just want to get the basics. blink.gif Pleaes help me. crazy.gif


The key is being patient and make small steps, one at a time. There is too much stuff to learn in one lifetime, so go steady and first look and read a lot and if you don't find answers on forums, search again. But I know how it is, cause I also went trough that period when I was a total beginner in programming (I supposed you are a beginner too smile.gif) and I wanted to learn everything imediatelly. It was the same when at 16 I wanted to learn playing the guitar imediatelly, cause it was sooo fancy. cool.gif

Even now I cannot say I am not a beginner in programming anymore. Even if it's around 10 years that I am (more or less passively) dealing with different sorts of programming languages. Now I am already 29 and I finished my first year of studies of informatics. It helped a lot finishing the two exams: basics of programming 1 and 2 (Java and C).

So, asking people to give you the code is a nonsense, believe me. There is many forums and many more topics or articles you can study. I am also a beginner with CF but I am patiently reading stuff on the internet and from time to time I make a post on the forum. There is many reference on the internet and if you really enjoy programming, eventually you will learn. Fingers crossed you learn a lot. Hold yours for me too. smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 12:07AM

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