This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > June 2004 > automatically updating table data





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author automatically updating table data
weckels

2004-06-09, 5:53 pm

I have 50 pages each with its own table. The data for these tables comes from
50 text files. In design mode, I can import the data from the text files into
the corresponding tables. The problem is, the data in the text files changes
frequently and with so many tables it takes forever to keep them updated. Is
there a way that I can just upload the text files to the site and have all the
tables be automatically updated without having to go into design mode with
every table? Any help would be greatly appreciated!!!

Thanks!

Murray *TMM*

2004-06-09, 5:54 pm

What format is the text file? Is it a comma-separated value file?

You could certainly investigate the use of server-side includes for your
content, but I'm not sure about your formatting issues.

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver MX
(If you *MUST* email me, don't LAUGH when you do so!)
==================
news://forums.macromedia.com/macromedia.dreamweaver - THE BEST WAY TO GET
ANSWERS
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================

"weckels" <webforumsuser@macromedia.com> wrote in message
news:c9vsiv$iif$1@forums.macromedia.com...
> I have 50 pages each with its own table. The data for these tables comes

from
> 50 text files. In design mode, I can import the data from the text files

into
> the corresponding tables. The problem is, the data in the text files

changes
> frequently and with so many tables it takes forever to keep them updated.

Is
> there a way that I can just upload the text files to the site and have all

the
> tables be automatically updated without having to go into design mode with
> every table? Any help would be greatly appreciated!!!
>
> Thanks!
>



weckels

2004-06-09, 6:02 pm

Murray,
Thanks for the reply. The text files are csv.

Thanks again,
Will
Gary White

2004-06-09, 6:02 pm

"weckels" <webforumsuser@macromedia.com> wrote in message
news:ca3c8s$pcg$1@forums.macromedia.com...
>
> Thanks for the reply. The text files are csv.


If it's CSV, you could parse it with a server side script. What scripting is
supported on the server?

Gary


weckels

2004-06-09, 6:04 pm

Gary,
I don't know much about server side scripting and I don't know what scripting
my host has (sorry for being so ignorant). I was hoping that there was
something in Dreamweaver that would do the trick. Would the "on-click"
behavior work somehow? When the page link is clicked on, the table would be
refreshed. Would this be possible? Sorry I am not up-to-speed on scripting.
I appreciate your help.

Will

Gary White

2004-06-09, 6:04 pm

"weckels" <webforumsuser@macromedia.com> wrote in message
news:ca5ork$lug$1@forums.macromedia.com...

> I don't know much about server side scripting and I don't know what

scripting
> my host has (sorry for being so ignorant). I was hoping that there was
> something in Dreamweaver that would do the trick. Would the "on-click"
> behavior work somehow? When the page link is clicked on, the table would

be
> refreshed. Would this be possible? Sorry I am not up-to-speed on

scripting.
> I appreciate your help.



No problem, Will. We have all been new once upon a time. The issue is that
HTML is a static language and JavaScript executes after it's delivered to
the browser and has no access to either the server or the local machine's
file system. That means that there's no way to import and parse an external
file with either of those technologies. It MUST be done on the server,
before the page is sent to the browser. Any web host worth having will offer
one or more server side scripting languages. It could be ASP, PHP,
ColdFusion, Perl, etc. Check your host's FAQ pages, or call them and ask
what scripting languages they support. Once you have the answer, it will be
relatively easy to write the script.

Gary


weckels

2004-06-10, 11:14 pm

Gary,
Here is some info. Hope this is what you were looking for.

Supported Languages
? PHP 4.3.3
? PERL 5.6.1
? Apache 1.3.27
? Python 2.2.2
? ModPerl 1.26_5
? Mod SSL 2.8.12
? ChiliSoft! ASP 4.0.1
? sendmail 8.11.6-15
? Common PERL Modules
? mysql 3.23.54a

Advanced Features

? Server Side Includes
? Cron Jobs
? Cgi-bin
? PHP Myadmin 2.3.2

I have an e-commerce account with OLM.net.
Thanks again for helping me out!!

Will


Gary White

2004-06-10, 11:14 pm

"weckels" <webforumsuser@macromedia.com> wrote in message
news:caatl2$3g3$1@forums.macromedia.com...
> Gary,
> Here is some info. Hope this is what you were looking for.
>
> Supported Languages
> ? PHP 4.3.3



It supports PHP. This should do it for you. It assumes that the text file is
a CSV file and that it is located in the "includes" directory which is at
the site's root level. All you need to do is change the file name (in the
second line) from "myfile.csv" to the name you want to use on a particular
page. Change the path (in the third line) to the actual root relative path
where the files are stored.

<?php
$filename="myfile.csv";
$path=$_SERVER['DOCUMENT_ROOT']."/include";
$fp = fopen ("$path/$filename","r") or die("Cannot open file: $filename");
echo "<table>\n";
while ($line = fgetcsv ($fp, 1000, ",")) {
echo "\t<tr>\n\t\t";
foreach ($line as $data){
echo "<td>$data</td>";
}
echo "\n\t</tr>\n";
}
echo "</table>\n";
fclose($fp);
?>

Gary


weckels

2004-06-14, 7:14 pm

Gary,
Thanks for the reply. Where would I type the code? In a blank html page? I
don't know anything about programming in PHP. Does this code take info from
the text file and insert it into a html table? If so, how do I make the data
in the csv go into the corresponding fields in the html table? Thanks again
for all your help.

Will

Gary White

2004-06-14, 7:14 pm

On Mon, 14 Jun 2004 16:42:02 +0000 (UTC), "weckels"
<webforumsuser@macromedia.com> wrote:

> Thanks for the reply. Where would I type the code? In a blank html page? I
>don't know anything about programming in PHP. Does this code take info from
>the text file and insert it into a html table? If so, how do I make the data
>in the csv go into the corresponding fields in the html table? Thanks again
>for all your help.



For an example, insert the code between the <body> and </body> tags of a
blank page, named with a .php file extension. It will create the table
and parse the .csv file so that the fields in the .csv go into the
table. Once you see how it works, you can do whatever else you want to
make the page prettier and include other content.


Gary
Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews