PDA

View Full Version : Trying to load text from a external file into a page of HTML. Where to start?


benjamin308
05-28-2011, 02:40 PM
Hello there. There are a few pages in my Dreamweaver site which will require loading text from an external text file. It will be a lot of text so will need some kind of 'page 1, page 2' links on the HTML page to include it all. What kind of technology should I be exploring to achieve this? Could this be a javascript thing?

Any help very much appreciated.
Ben

gentleone
05-28-2011, 04:00 PM
Do you mean with external text file a .txt document?

benjamin308
05-28-2011, 04:09 PM
Do you mean with external text file a .txt document?

Hi gentleone. Thanks for your reply. Ideally yes, a .txt file.

gentleone
05-28-2011, 04:20 PM
You can do this indeed with javascript (AJAX in particular). Here's a simple demo that uses HTML in text files :roll: , but this could also be of course just a HTML page. It's also not the best example out there, because it's not really SEO friendly.
http://karypace.byethost33.com/ajax/ajaxloadcontent.php

benjamin308
05-28-2011, 04:28 PM
Great, thanks for that. I will investigate. I just had a thought, would it be good to use iframes?

gentleone
05-28-2011, 04:46 PM
using iframes or the example I gave you are both not the best options... actually they're pretty worse for SEO (no unique url's) and the user experience (bookmarking and back button).

There are better AJAX scripts, but they require some coding skills... I will have a search for you.

benjamin308
05-28-2011, 04:52 PM
using iframes or the example I gave you are both not the best options... actually they're pretty worse for SEO (no unique url's) and the user experience (bookmarking and back button).

There are better AJAX scripts, but they require some coding skills... I will have a search for you.

That's very kind of you gentleone. I appreciate it.

gentleone
05-28-2011, 05:11 PM
I've posted some links in another thread not so long ago.
http://www.dreamweaverclub.com/forum/showpost.php?p=194110&postcount=3

benjamin308
05-30-2011, 01:04 PM
Thanks for your help gentleone, has been very useful.

gentleone
05-30-2011, 03:59 PM
Thanks for your help gentleone, has been very useful.
You're welcome, Benjamin! Personally I like the bydust script the most. If you use the back/forward button in your browser it keeps the fade-in effect.
http://www.bydust.com/examples/com.bydust.ajax/

The queness example loses the fade-in effect with the back/forward button.