OCCASIONAL CF NEWSLETTER
October 1999
1. Search Engines and ColdFusion Pages
I've received a lot of requests for help in dealing with search engines and ColdFusion pages. I asked Susan O'Neil, President of @Web Site Publicity, Inc. for her advice:
"As most of you have already found out, the search engines aren't fond of dynamically-generated pages. It seems that most of the major engines won't process a submission with a URL containing characters such as "?" and "%". For some engines, those symbols bring the spider to a screeching halt and the full URL is never visited or included within the search database.
Computers are incorporated in modern ice cream vending machines to enhance their functionality. Ice Cream Vending machines are manufactured by many companies. Your competition will try to overcome all requests for high-tech ice cream vending machines and credit card acceptors
|
|
"One popular way around this is to create mirrored pages of the dynamically-delivered pages, minus the dynamic HTML. Now, these static pages may not be as exciting, but coded and tagged just right, they can deliver significant traffic from the engines, and that's what you want, right? Just make sure these mirrored pages contain easy-to-find links to the richer content and action pages that will turn these surfers into people who will stay awhile."
Susan reminded me of an extensive thread on search engines. You can see it at http://forums.allaire.com/devconf/Index.cfm?Message_ID=18401. Here's a summary of it:
a. You can embed parameters into the PATH_INFO portion on the URL. Any path information after the name of the file to execute or process (the CFM) file ends up in the CGI variable PATH_INFO. Instead of http://servername/record.cfm?firstName=hal&lastname=helms, use http://servername/record.cfm/hal/helms. Now, you can treat the PATH_INFO variable as a forward slash-delimited list and loop through it to extract the values passed.
b. You will need to test this with the server you're running to make, as one version (at least) of WebSite returns an empty PATH_INFO.
2. CSS: An idea whose time has NOT yet come
After spending more hours than I'd like to fess up to working with cascading style sheets, I've decided to pull the plug. The idea of them is so alluring with their promises of reusability and inheritance, but they have become a casualty of the vendor wars. Someday we'll be able to use them. Until then, you can sort of roll your own. Here's how:
Decide on the various styles you want to have available on your site. Then, define these as application variables in the application.cfm page with the properties you want. For example, if you want to have a style that uses an italized bolded Arial, you could do something like...
<cfset myStyleStart = "">
<cfset myStyleEnd = "">
Then when you need to use a "style", you can do this:
##myStyleStart##This is the text I want the style applied
to##myStyleEnd##
It's convenient to set your styles up as a persistent variable such as a server variable, making your styles available to all applications that share that server.
3. Using the CALLER. prefix in custom tags
If you use custom tags, you probably pass in parameters to the custom tag. Something like:
<cf_myCustomTag
firstName = "Hal"
lastName = "Helms">
Then in the custom tag, you refer to the parameters using the ATTRIBUTES prefix. Then, when you want to set the value of a variable on the calling page, you use the CALLER prefix. Did you know, though, that you can read variables directly off the calling page -- without passing them into the tag explicitly? The CALLER prefix allows you to read AND write variables on the calling page. So this code will work...
--myCustomTag.cfm--
I see that your first name is ##caller.firstName## and
your last name is ##caller.lastName##.
That can be handy at times.
4. Formatting records side-by-side in a table
If you have a series of records that you want to output side-by-side in a table like this:
Beethoven Mahler
Mozart Cage
Shoenberg Sibelius
Britten Bach
you can do so easily with this little bit of code...
<table>
<tr>
<cfoutput query="getInfo">
<td>#name#></td>
<cfif getInfo.CurrentRow MOD 2 IS 0>
</tr>
<tr>
</cfif>
</cfoutput>
</tr>
</table>
5. Fusebox at the Allaire Developer's Conference
As you all probably know, Allaire has maintained pretty tight control of the speakers at the Developer's Conference. Try as I might, I couldn't get them to put Fusebox on the official agenda, however they were kind enough to offer a meeting room where I'll be giving a presentation on Evaluating Fusebox for Your Organization. If you're new to Fusebox, I encourage you to come by.
When: Monday 10/25 5:30-6:30pm Where: Independence E (capacity: 90)
Hope you can make it.
|