Skip to main content
Participant
March 11, 2010
Answered

Newbie ? about variables

  • March 11, 2010
  • 2 replies
  • 403 views

I am completely ignorant concerning CF, for that matter I am generally ignorant as well.  I own a website written in CF that I need to change.  I am changing the URL to the site and need to update links within the site to reflect the changes.  Most of the links contain a variable which would make the job easy but…. I do not know where the variable is set.  I have pasted a sample page of code below:

<cfinclude template="urlhelp.cfm">

<cflock scope="application" type="exclusive" timeout="30"><cfset variables.homepage = homepage></cflock>

<cfparam name="title_tag" default="Lifestyles Direct Tan Through Suits">

<cfparam name="meta_description" default="Lifestyles Direct Tan Through swimwear allows you to achieve the perfect all over tan.  Our fashionable line of women’s swimwear and men’s swimwear is guaranteed to be tan through, but not see through wet or dry!">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="description" content="<cfoutput>#meta_description#</cfoutput>">

<title><cfoutput>#title_tag#</cfoutput></title>

</head>

<link href="<cfoutput>#homepage#</cfoutput>/solartan.css" rel="stylesheet" type="text/css">

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td><table width="100%" border="0" cellpadding="0" cellspacing="0" background="<cfoutput>#homepage#</cfoutput>/images/beach_bkg.jpg">

I see in line 2 the reference to variables.homepage = homepage but do not understand how that sets anything.  I also see where the variable is called in the last line I posted as: background="<cfoutput>#homepage#</cfoutput>/images/beach_bkg.jpg"

If you need more information I will do my best to provide it.  Thanks in advance for any help!

    This topic has been closed for replies.
    Correct answer ilssac

    In the first review, I must say I don't see much use for that variable myself.  It is being used to build a base url for links and such, but that does not make much sense as the value is set in the page itself.

    But other places you should look to get a more complete picture of what is going on.  What does the urlhelp.cfm file do.  The name of the file makes it sound like it might be relevant to this topic.

    Also there is the default include files, Application.cfm *OR* Applicaiton.cfc depending on the age of your applicaiton.

    2 replies

    Inspiring
    March 12, 2010

    ColdFusion is actually one of those tools that it will be well worth your time to get to know much better.  (There are also third-party implementations.)

    Of the various platforms I have used in past lives, there is "a subtle but important cleverness" to what they've done and how they've done it.  There is much more to this system than initially meets the eye, vis-a-vis other more well-known systems like PHP.  It will be worth your time to get to know it better.

    According to the online documentation such as http://livedocs.adobe.com/coldfusion/8/htmldocs/, in the section ColdFusion Developer's Guide / Using ColdFusion Variables / Using Periods in Variable References, the "Variables.variable" syntax is a reference (in this case) to what ColdFusion calls a scope.  (This particular scope-name is actually mentioned on that page.)

    Two sections down, in ColdFusion Developer's Guide / Using ColdFusion Variables / About Scopes, we find a complete list of these "scopes" including the "Variables." scope.

    The particular statement that you refer-to looks like a "do-nothing" because this scope is actually implied:  the statement appears to be assigning the variable to itself.  Nevertheless, ColdFusion has been around for a while now and it has evolved quite a bit during that time.  Useful things have been added to the system in each of its incarnations.  You might be looking at older code wherein such methods were deemed to be necessary.  Or it could be a bug.  Who knows.

    ilssac
    ilssacCorrect answer
    Inspiring
    March 11, 2010

    In the first review, I must say I don't see much use for that variable myself.  It is being used to build a base url for links and such, but that does not make much sense as the value is set in the page itself.

    But other places you should look to get a more complete picture of what is going on.  What does the urlhelp.cfm file do.  The name of the file makes it sound like it might be relevant to this topic.

    Also there is the default include files, Application.cfm *OR* Applicaiton.cfc depending on the age of your applicaiton.

    bj132Author
    Participant
    March 11, 2010

    Ian,

    Thanks for the help.  I had already checked the urlhelp.cfm file but found nothing.  After your reply I found the application.cfm file and found the cfset homepage command.  Did I mention I know nothing of CF?

    I made the change and all is right with the world once again.

    Thanks again.