Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I display external file contents in a layer ?

Status
Not open for further replies.

SteveEBoy

IS-IT--Management
Sep 13, 2007
3
Hello.

I have various external files containing information. I'd like to display the contents of a given file in a layer when I choose a particular menu option e.g. 1 layer, 3 menu items link 1, link 2, link 3 and 3 files file 1, file 2, file 3. Clicking link 1, populates the layer with the contents of file 1 etc.

I'm using DW 8 and tried using the "Set Text of Layer" behaviour with "OnClick" on each menu item but can't seem to display contents of a file. Harcoded text is OK.

Thanks for any ideas.
 
You'll need a server-side language to load the files into the layer.

What language is available to you? ASP, PHP, ColdFusion?




----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Ah, OK. thanks for the reply. I've got access to PHP and I think ASP (will need to check). Someone suggested using the iframe tag - which I'll try too.

What would be the logic you're thinking of with the server side programs - would they read the external files and populate the layer contents by polling for changes or do you think I'd be better just triggering the job when I've updated the files ? Probably the second option ?
 
iframes, are highly discouraged now a days since they can cause accessibility problems.


As for the server side language approach.

You don't need to run anything after updating the pages that are to be included. the Server Side Language will read form the file and load the file upon every request to the page. Any changes made to the file will show up immediately when the parent page is requested.


in PHP its as simple as:

Code:
<?PHP
include("path\to\file.ext");
?>

Just Place it wherever you want the file to be included.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Vacunita, it sounds like the original question is about dynamically loading data into a div.

I'd look at AJAX to load external data or some other kind of JavaScript method(s) of hiding/displaying layers that were preloaded in the document server-side (keeping in mind that some users will have JavaScript disabled).

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Just sounds like he wants to display file contents in a div yes. PHP can do it very easily.

Make links that look like:
Code:
<a href="mainpage.php?pagenametoload">A link</a>

Then juts take that value and use it to load the contents.
Code:
include("path/to/$_GET['pagenametoload'].ext");



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks - I'll try the PHP solution. It's not something I've got much experience of but I'll use the structure in your logical examples and see how I get on.

Thanks very much.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top