Log in

View Full Version : text or .doc file controlled web content



Mehok
01-17-2007, 03:22 PM
I was wondering if its possible to link a content section of a html page to a .txt or a .doc file so if for example i make a page and the client wants to update the content him self so he opens the .doc or .txt file and any changes that he does there in that file automaticaly changes in the html page or web site

beau
01-21-2007, 04:41 AM
well... as far as i know .doc files will force microsoft word to open. However, if you include .txt files then they will be able to be edited via IE or FF. You could write a php script to fopen the txt files and the client, or what not, can open it from IE and FF and edit it directly.

hope this helps.

Mehok
01-23-2007, 04:46 PM
let me expalin it a little more in this diagram

for example here is a black content in a website .html file

....


and here is a .txt file

.....


so if you for example change that to a ? at the end it will automatically change it in the html file so that the html file when opend will have

.....?

i am still looking for the code but will post if i get it before anyone here

so please give all the help you can


_______
for all the hosting needs go to www.bitnethosting.com
and if you require a custom account that will also be set up apon requesr
ref: 8855123

djr33
01-24-2007, 01:35 AM
Beau, neither FF nor IE will let you edit a text file.

Using a .txt would be the best answer; .doc is a proprietary format that has a LOT of extra junk in it, so parsing all of that and making into it into html would be a pain.

Either way, it's quite easy with PHP, like was said. But... you don't need to bother with fopen().

All you need is this:

<?php file_get_contents('yourfile.txt'); ?>

Note: .txt is just a note to the computer for what filetype it is. You could use .inc (include), .doc (just not use a MS word file), etc., or even create your own (.content), or something. Doesn't really matter all that much.


Note that to use PHP:
1. Your server must have PHP installed/enabled.
2. Your page must end in .php (not .htm; it will work the same as .htm, though; don't worry)*
(*you could also deal with changing the .htaccess config file so .htm is parsed with php, but that's probably more than is worth dealing with.)