PDA

View Full Version : Dynamic Text w/ Dreamweaver



dangerousjohnny
September 15th, 2003, 03:03 PM
Hi,
Is there a way to have a textbox/field that references a text file with some information so when I update the site I just have to update the text file?

λ
September 15th, 2003, 03:54 PM
well... not really. You could use an iFrame, but those aren't really what you want to do.

The easiest way to do this is simply to use PHP or Server-Side Includes.

For instance, in PHP:



<?php
include("file_name.txt");
?>

however, your server needs to support PHP in the first place

eilsoe
September 16th, 2003, 08:26 AM
yep.. can't really do anything "dynamic" in pure html... to my knowledge at least :sure:

dangerousjohnny
September 16th, 2003, 10:20 AM
Maybe dynamic is a misleading word... Can you use HTML to 'include' files... like above mentioned with php, excecpt in html??

λ
September 16th, 2003, 11:15 AM
hmm... I just thought of a possible workaround... it involves using Flash though...

Would the site you're doing enable you to use a 1x1 px transparent SWF somewhere?

If so, you could load the text using LoadVars or XML, then use FSCommand or getURL() to call JavaScript that would write to a layer...

dangerousjohnny
September 16th, 2003, 11:30 AM
I could put flash in my site... how exactly would I do it?

λ
September 16th, 2003, 11:34 AM
well... I don't really know JavaScript... I'm afraid you're going to have to wait for someone with more knowledge than me :)

JMS
September 17th, 2003, 10:13 AM
If your webserver supports server side includes, just include the txt file like so:


<!--#include file="textfile.txt" -->

Remember to name the file with a .shml extension in order for it to work.

I don't know if that works for a text field. You could try making the text field like so:


<input type="text" value="<!--#include file="textfile.txt" -->">

I have no idea if that will work :-\