Skip to main content
Participant
September 20, 2008
Question

New to CF... just a few questions...

  • September 20, 2008
  • 1 reply
  • 284 views
I am a php/MySQL coder, but have a projected I was hired for that requires CF for certain elements, including an FTP system. Therefore, I had a few basic questions since I have zero CF experience. Small code examples are greatly appreciated!

(1) Is there a simple way to output server configurations (like phpinfo() with php)?

(2) What file extensions are parsed by coldfusion by default? (like, in php, I can parse .php, .php4, .php5 by default)

(3) I am looking for a small snippet of code that will output the root directories subdir and files, like so::
Root Directory
--------Somefile1.jpg
--------Somefile2.php
--------Subdirectory1
----------------Somefile3.php
----------------Somefile4.php

Thanks in advance!


This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
September 20, 2008
(1) Is there a simple way to output server configurations (like phpinfo() with php)?
Yes, <cfdump var="#server#">. But you will get a much shorter summary than with PHPinfo.

(2) What file extensions are parsed by coldfusion by default? (like, in php, I can parse .php, .php4, .php5 by default)
cfm, cfml, cfc, cfswf, cfr, jsp, jws

(3) I am looking for a small snippet of code that will output the root directories subdir and files
Save and run the following code as the file listDir.cfm in the directory that you wish to list.

<cfdirectory directory="#getDirectoryFromPath(expandPath('*.*'))#" name="dir" action="LIST" recurse="yes">
<cfdump var="#dir#">

It works for any arbitrary directory. However, be aware that setting the recurse attribute to "yes" instructs Coldfusion to look into directories within directories, directories within directories within directories, and so on. That could take long.

I have saved the best for last. You can use Sean Corfield's scripting tag to run your PHP code directly in Coldfusion. But then, you will need Coldfusion 8, which runs on Java 6.