#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    1
    Rep Power
    0

    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:
    Code:
    Title example 1
    Description example 1
    Link example 1
    Title example 2
    Description example 2
    link example 2
    So I would need to display "Title example 1" on my website through html, so I can apply some style to it like this:
    Code:
    <Td>
              <Div class="EntryDesc">
                <a href="LINK1" class="blog-article-a"><h3>Title example 1</h3></a>
                <p>Description example 1</p>
              </Div>
            </Td>
    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.
    Any suggestions please?
    Thanks!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    Any reason you're avoiding a database?
    He who knows not and knows not he knows not: he is a fool - shun him. He who knows not and knows he knows not: he is simple - teach him. He who knows and knows not he knows: he is asleep - wake him. He who knows and knows he knows: he is wise - follow him
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    67
    Rep Power
    0
    I have a feeling what you're trying to do has been done in countless frameworks and CMS's.

    If you really just want to get the website working and so the user can update it easily, look into Word Press.

    If you're doing this because you want to learn to web program, look into using a database and a server side language such as php.
  6. #4
  7. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,111
    Rep Power
    1990
    You need a server-side programming language. If you're starting out I'd suggest learning PHP as that's most likely going to be the easiest starting point.

    What you'd need to do is...
    1. Read in the text file
    2. Break the text file into individual lines
    3. Parse each line to determine what it is and how to display it
    4. Output the HTML for that line
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2014
    Location
    Lawrence, KS, USA
    Posts
    7
    Rep Power
    0
    You could also use JavaScript to read the text file and write the html/text code. But I like the other responses better because they address the over arching issues.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2014
    Posts
    19
    Rep Power
    0
    My advice that your need learn server side language. Like a asp.net or php.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Location
    Adelaide - Australia
    Posts
    31
    Rep Power
    2
    Originally Posted by Dzonny
    Code:
    <Td>
              <Div class="EntryDesc">
                <a href="LINK1" class="blog-article-a"><h3>Title example 1</h3></a>
                <p>Description example 1</p>
              </Div>
            </Td>
    First I don't know what the Td's are for unless you are placing the div's inside tables?

    And let's fix the mistakes with the h3's before you start, otherwise the script will return a warning
    Code:
    <div class="EntryDesc">
    <h3><a href="LINK1" class="blog-article-a">Title example 1</a></h3>
     <p>Description example 1</p>
     </div>

IMN logo majestic logo threadwatch logo seochat tools logo