6 replies [Last post]
soma56
soma56's picture
Offline
Regular
Last seen: 12 years 21 weeks ago
Timezone: GMT-5
Joined: 2008-07-25
Posts: 31
Points: 0

I did some Googling and couldn't find a way to grab text from another file on a server. Is there a way in CSS (or html for that matter) to 'dynamically' grab the text from a .txt or .doc (or any extension) and display it? :rolleyes: For example:

This may seem neurotic to some of you veterans on here however my logic is that it would be easier for a client to simply drop a .txt file with text updates rather then open an html file to edit it. If you have any other suggestions I'm open to them. My solution arises a new issues though:

1) How do I limit the length of the text to...say...300 characters?

Tags:
Triumph (not verified)
Anonymous's picture
Guru

CSS is styling, nothing

CSS is styling, nothing else. It can not be used to include external pages into your web pages.

Do you understand php, ASP.NET or any other web programming language?

soma56
soma56's picture
Offline
Regular
Last seen: 12 years 21 weeks ago
Timezone: GMT-5
Joined: 2008-07-25
Posts: 31
Points: 0

No

Unfortunately I don't but perhaps you could point me in the right direction.

Triumph (not verified)
Anonymous's picture
Guru

soma56 wrote:Unfortunately I

soma56 wrote:

Unfortunately I don't but perhaps you could point me in the right direction.

Well, I suppose I could but you'd have to tell me what sort of servers you are planning to use.

soma56
soma56's picture
Offline
Regular
Last seen: 12 years 21 weeks ago
Timezone: GMT-5
Joined: 2008-07-25
Posts: 31
Points: 0

These guy

Triumph (not verified)
Anonymous's picture
Guru

soma56

OK, you have a *nix type PHP server.

You could have a file such as sample.txt and use a php include like this to add it to a page: <?php include('sample.txt'); ?>

The page with that include in it must have the .php file extension to parse under normal circumstances.

Limiting the length of a file probably requires reading the content of the file into a string and taking the first so many characters from the string. I've left the php world for greener pastures (ASP.NET) so I'm not savvy on the best practice in this case. Look up fopen(); maybe.

I'm moving this to "Off Topic".

soma56
soma56's picture
Offline
Regular
Last seen: 12 years 21 weeks ago
Timezone: GMT-5
Joined: 2008-07-25
Posts: 31
Points: 0

Thanks

I'll give it a shot in the next week and let you know how I made out.

Thanks :rolleyes: