|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Hello,
Is there a way in ColdFusion to loop through all the files in a folder and drop some links on a page according to what's there? I've got a bunch of Excel pages and would love to be able to create a page that automatically links to them. Thanks, Peter |
|
#2
|
|||
|
|||
|
You have to use <cfdirectory action="list"> tags. See documentation for the tag description or else you can look in developer exchange for some custom tags
|
|
#3
|
||||
|
||||
|
I'm not sure what you want to do, plus it's late and i'm tired, plus i've got a Final tomorrow and i should be studying instead of helping you, but i'm sure there will be a time when you help me in return. If not well then all i can say is
This should get u started Code:
<CFQUERY NAME="Exceltables" DATASOURCE="YourDatabaseName">
SELECT TableID, Column Name1, Column Name 2, etc.
FROM Table Name
ORDER BY Whatever you want
</CFQUERY>
<!--- Provided by Alas from Wickedwd.com --->
<!--- You're a dork if u erase my name --->
<HTML>
<HEAD>
<TITLE>Excel Tables and such</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<!--- remeber the TableID column is your primary key in the DB --->
<CFOUTPUT QUERY="Exceltables">
<TR>
<TD>
<B><A HREF="Pagewheretablesareat.cfm?TableID=#URLEncodedFormat(Trim(TableID))#">#ColumnName1 or 2, whatever#</A></B>
</TD>
</CFOUTPUT>
</TABLE>
</BODY>
</HTML>
Ps hope this helps, im off to study. Check u later, Alas |
|
#4
|
|||
|
|||
|
I think the question was directed more at reading files from a directory, not a database. If this is indeed the case, then using <cfdirectory> is the best route.
|
|
#5
|
||||
|
||||
|
yeah, it's pretty easy, here's my version
Code:
<CFDIRECTORY NAME="myfiles"
DIRECTORY="#ExpandPath('.')#"
FILTER="*.*m*"
SORT="DateLastModified DESC">
<h3>My Files</h3>
<p><CFOUTPUT QUERY="myfiles">
#myfiles.DateLastModified# <a href="#myfiles.Name#">#myfiles.Name#</a><br />
</CFOUTPUT></p>
the filter pulls out only .*m* file extensions, e.g. .cfm, .htm, .html |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > loop through all files in a folder |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|