Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Coding CSS for Webpage to Read .TXT File


  • Please log in to reply
7 replies to this topic

#1 Teach Power

Teach Power

  • Members
  • 54 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:FL
  • Local time:10:12 AM

Posted 30 December 2010 - 04:24 PM

Hello all. I hope you all are having a great Christmas holiday.

I am redoing a simple webpage for my father-in-law for our military collectables and antiques family business [old site: pinomilitaria.com]. He is not very computer literate and thought it would be easier for him to write/change descriptions for each of the collectables via a .TXT file. Then all he would have to do is upload the .txt file to the hosting server and the page would read it and display the text. I was figuring that this could be done through a CSS. Could someone tell me how to go about doing this so I can get him up and running.

Thank You.

Edited by Teach Power, 30 December 2010 - 04:25 PM.

-TeachPower
TeachPower.net founder
Education Resource Library for the classroom & boardroom

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:12 AM

Posted 30 December 2010 - 10:27 PM

CSS does not have that sort of capability; neither does HTML. You are going to need to use something like PHP to do that.

#3 Teach Power

Teach Power
  • Topic Starter

  • Members
  • 54 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:FL
  • Local time:10:12 AM

Posted 30 December 2010 - 11:06 PM

Hi groovicus. Long time no see :thumbup2:! Could you show me how to do that or point me somewhere that will help me learn how to code that into my webpages and .TXT file? Thanks budro.
-TeachPower
TeachPower.net founder
Education Resource Library for the classroom & boardroom

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:12 AM

Posted 31 December 2010 - 11:25 AM

There are tons of examples on the web that show you how to do this using any number of languages. Your question is sort of broad since doing what you want to do requires a number of steps; first you need to know how to use PHP (assuming you choose to use PHP) and HTML together to dynamically generate web content. You need to know how to read a file. You need to figure out how to parse the content that is read from the file and put it in the proper place in the web page.

#5 Teach Power

Teach Power
  • Topic Starter

  • Members
  • 54 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:FL
  • Local time:10:12 AM

Posted 31 December 2010 - 06:33 PM

Any places on the web you recommend?

Happy New Year Everybody!
-TeachPower
TeachPower.net founder
Education Resource Library for the classroom & boardroom

#6 somdcomputerguy

somdcomputerguy

  • Members
  • 17 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:West Virginia
  • Local time:09:12 AM

Posted 31 December 2010 - 10:54 PM

Try this tutorial - http://www.tizag.com/phpT/include.php
-bruce /* somdcomputerguy */
'If you change the way you look at things, the things you look at change.'

#7 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:12 AM

Posted 01 January 2011 - 12:34 PM

http://php.net/ is a good place to start.

#8 raj23

raj23

  • Banned Spammer
  • 3 posts
  • OFFLINE
  •  
  • Local time:07:42 PM

Posted 27 January 2011 - 01:54 AM

Hi,
You can't read the text file using CSS, In PHP it is possible we can use check the coding below.

<?Php
$file = $_SERVER['DOCUMENT_ROOT'] . "/text.txt"; //Path to your *.txt file
$contents = file($file);
$string = implode($contents);

echo $string;
?> 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users