Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: News Content from Texts uploads

  1. #1
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Unhappy News Content from Texts uploads

    Hi,

    I am new to the web development, my client is looking for a simple way to upload news to his website (static/HTML), were he just upload a text file with his news content, and his site updates the news pages, basically in 3 different areas: News Portlet (Home Page), Our News page, And the News Page itself.

    SO if he uploads file like "news17.text" it will be the latest news, which will be shown on the home page with link (read more) to the news page, and will also have similar content on the our news page with read more link.

    So how can i make such a setup, through googling i have understood, in need ajax, or server-side includes; but I am not getting exact scripts that helps me in my scenario.

    Thanks

  2. #2
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    one option, is to use php to open the textfile and print out it's contents onto the site.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  3. #3
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Is there any script for it. I dont know any thing on PHP.

  4. #4
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    You'd just use the fopen function on the file and then echo the contents into a div
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  5. #5
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    But then I have to change all my sites from .html to .php

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yes, you would. But it's worth it. That's the best way to do this. PHP isn't the only option. ASP, SSI and a few others are possible as well. It depends on what you want to learn and what is available on your server. PHP is most likely to be available and useful to you, but it's up to you (and your server).
    Also, I'd probably look into putting all of this into a database if I were you, but that's not necessarily required if this content isn't going to change very often and you don't mind managing the files as you've described.

    You could use Ajax instead, but it might actually be more difficult.

    Simply put, you're going to learn something new in order to do this. It's not an especially difficult task broadly speaking, but it's going to be challenging if it's the first time you've done something like this.



    (Also, changing all of your files from .html to .php is the least of your concerns. If that's what it takes, then just do it. But you can actually get around that if you really need to, by telling your server, probably via .htaccess, to treat .html as PHP code-- not my recommendation but possible. Ask if you need more information on that.)
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. The Following User Says Thank You to djr33 For This Useful Post:

    wrathyimp (09-25-2012)

  8. #7
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    this is a good tutorial on reading files with php. I agree with Daniel, it is very worthwhile learning some sort of server-side scripting language.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  9. #8
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks Daniel, Can give nore info on the ajax you have mentioned.
    Bernie, i will try the tutorial.

  10. #9
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    personally, I'd go for a server-side language such as ASP, PHP or Python rather than just Ajax, as when it comes to databases and other components of server-side computing, you would probably want to learn some of these in order to do all of that.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  11. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,134
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    I'm still a little unclear what the three pages are. How is Our News Page different from the News Page itself. If all of each story is to be on one of those pages and only snippets on the others, I think that the biggest challenge would be creating the snippets and linking them each to their respective full story counterparts.

    An XML file like is used in an RSS feed might be good.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Replies: 1
    Last Post: 01-17-2012, 08:29 AM
  2. How could i connect Content slider with my news database
    By yashwanth in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 05-04-2011, 01:03 AM
  3. News content slideshow?
    By paddyt007 in forum Looking for such a script or service
    Replies: 10
    Last Post: 09-22-2010, 09:40 PM
  4. Rotating Different Texts -- Same Function
    By ren1999 in forum JavaScript
    Replies: 1
    Last Post: 05-07-2010, 03:40 AM
  5. Replies: 5
    Last Post: 07-22-2006, 03:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •