Input in txt file - output in html?
Hello there all,
I have a website built for a local business and I need something like this if that's even possible to build.
So I would need something like ability to add some info (text and links) in some .txt file on server and to be able to display those informations based on lines in that txt files.
For example, let's say that I have following text file:
So I would need to display "Title example 1" on my website through html, so I can apply some style to it like this:
Title example 1
Description example 1
Link example 1
Title example 2
Description example 2
link example 2
So i need to use it inside html code, based on rows in txt (doesn't have to be txt though) if that's possible.
<a href="LINK1" class="blog-article-a"><h3>Title example 1</h3></a>
<p>Description example 1</p>
Any suggestions please?
You can do this in PHP, but you will need to write it bomb-proof if you want inexperienced users to be able to edit the text successfully. E.g. Your present suggestion appears to use just line breaks to delineate the heading, description and link, and separating one item from the next. That is likely to be succeptible to one stray line break f*****g up the whole list (not just one entry)!!! Oh, and bear in mind that MS Windows, Apple OS and Unix variants use DIFFERENT line termination codes!
Furthermore, word processors (instead of text editors) can, and do, sprinkle invalid characters throughout the so-called text file!!! Even in bits you did not edit!!!
Also, beware of more experienced user who may try to embed code in the text!!! Note: the latter may be done quite innocently, (e.g. adding <p> and </p> codes to split the text into multiple paragraphs) but can be malicious (which I will not give an example of)!!!
You have been warned!!!
Last edited by jedaisoul; 01-25-2014 at 11:28 AM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)