Can you pull contents of txt file into FP/html?

M

Marindi

I am a novice web designer, and would like some help with the following:

I'm setting up a homepage on our intranet for one of our departments. On the
page there will be a few tables with info e.g. News Items that will change
almost daily. I want them to maintain their own page, but they don't have FP
or coding experience.

Ideally I would like e.g. a cell in a table that pulls its contents from a
txt file. The other user can then open the txt file in Notepad, update the
relevant text they want displayed, and by saving it will automatically update
the contents in that cell on the homepage.

Is that possible? and if so, how do you set up the formatting for that cell
to stay the same when new content/text is imported? also, can they add e.g.
<b></b> tags around the heading to make it appear bold when the text is
imported into the html?

Thanks in advance for your help
 
R

Ronx

One method is to use a Content Management System (CMS) such as
Contentseed (http://contentseed.com) which only requires a web browser
to update the page content.

Alternatively, use Server Side Includes (SSI) to include the text page
content. SSI usually requires the page to have a .shtm, .shtml, .asp or
..php extension, depending on the requirements of the server.

To include a file add the line:

<!-- #include virtual="/pathtofile/filename.txt" --> where the text file
content should appear.
The text file can contain HTML tags such as <strong>...</strong>, but be
aware that if the file contains paragraphs they *must* be ended with the
HTML <br> tag, or surrounded by <p>...</p> if they are to be displayed
correctly in a browser. The CMS method automatically formats
paragraphs.
 
M

Marindi

Thanks Ronx!! I will try it out. Asked our server admin lady about SSI but
she doesn't know if our server supports it, so will try it out. Can I just
save my normal .htm page as a .shtm?
 
R

Ronx

Almost every server will support SSI, unless the admin has deliberately
switched the feature off.
You can rename your .htm and .html pages to .shtm, except the home page
- FrontPage will not accept .shtm as valid for a home page unless you
edit directly on the server, and .shtm is in the server's list of
acceptable default page extensions, though if your server is Windows
then you can probably use .asp instead without problems.

--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

http://www.rxs-enterprises.org/fp
 
M

Marindi

Thanks for both for replies! I have tried it and kept getting the 404 Error.
Someone in my office suggested using "#include file" instead of "#include
virtual", and it's working! I've saved the page as .asp.

Only problem is the txt file is currently in the same folder as the .asp
page, but as soon as I change the path to a file on a server, it's doesn't
find it. Maybe my path is in the wrong format? I typed e.g.:
<!-- #include file="//Digit/Documentation/News2.txt" -->
Should the path name be different? or is there a function in FP that will
allow me to include the file by browsing and picking one?
 
R

Ronx

The text file MUST be within the website.

You can use either:

<!-- #include virtual="/path/to/textfile/News2.txt" -->
Or
<!-- #include file="../path/to/textfile/News2.txt" -->


In the first case, notice the initial "/" signifying the root folder of
the website, and path/to/textfile is the folders the file is located in.
For example, if the website is http://intranet.com, and the News2.txt
file is in the Documentation folder at
http://intranet.com/Documentation/News2.txt , then use
<!-- include virtual="/Documentation/News2.txt" --> This will work
wherever the page itself is located in the website.


In the second case, ../path/to/textfile is the relative path from the
page to the text file.
If the page is at http://intranet.com/information/page.shtm, and the
News2.txt file is at http://intranet.com/Documentation/News2.txt, then
use
<!-- include file="../Documentation/News2.txt" -->

In my opinion this is slightly harder to set up unless the News2.txt is
in the same folder as the page, or a subfolder.

You cannot place the News2.txt file on a different server - neither
method will work in that case.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

http://www.rxs-enterprises.org/fp




Thanks for both for replies! I have tried it and kept getting the 404 Error.
Someone in my office suggested using "#include file" instead of "#include
virtual", and it's working! I've saved the page as .asp.

Only problem is the txt file is currently in the same folder as the .asp
page, but as soon as I change the path to a file on a server, it's doesn't
find it. Maybe my path is in the wrong format? I typed e.g.:
<!-- #include file="//Digit/Documentation/News2.txt" -->
Should the path name be different? or is there a function in FP that will
allow me to include the file by browsing and picking one?
 
M

Marindi

Hi Ron,
Your reply is very helpful - thanks!!! I will play around with the files and
paths as per your suggestions
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top