Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28

Thread: News Content from Texts uploads

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

    Default

    Well, I'd suggest splitting each part of each news story with a delimiter so you can split them into parts.
    "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

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

    Default

    Bernie, can you explain which part to split, like different text files for each snippets or from the same file we define each part based on word/character count.

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

    Default

    well, in the php, you would use fopen() to open the text and store it in a variable, but when you had written the text, in the .txt file, between the entries, you put a delimeter, say just some specific character or set of characters. What wou would do then, is use the php explode() function to split the variable at a delimeter giving you each entry in an array, which you can then print onto the array.
    for the snippet part when you have each entry in the array, you could store the snippets in another array using the substr() function to only get the amount of chars you want.
    "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

  4. #14
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    2,027
    Thanks
    16
    Thanked 315 Times in 313 Posts
    Blog Entries
    13

    Default

    Maybe this kind of thing will get you started?: http://jemthingsandstuff.co.uk/testi...-news/home.php

    I've attached a zip of the sample files - the individual news text files are numbered sequentially with the biggest number currently sorting to the top.

    text-files-news.zip
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

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

    Default

    Thanks,
    This is similar to What I was looking for.
    On the Home.php, we have news at the bottom give "Sorry - no news previously selected." Whats the purpose of it?

  6. #16
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    2,027
    Thanks
    16
    Thanked 315 Times in 313 Posts
    Blog Entries
    13

    Default

    Just to illustrate that the link/url without the news number query string returns an empty result.

    You'll notice that the read more's use the same news page but take the query string number to load in the corresponding text file.

    You should still include the empty string read out though to let users know when something went wrong - if there's anything that *can* go wrong, average-Joe is going to find it!
    Last edited by Beverleyh; 09-26-2012 at 07:03 PM. Reason: typos
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

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

    Default

    See here for information about explode()
    And here for information about substr()
    "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

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

    Default

    Thanks Again Beverleyh, But I need a similar script to add to my html pages.

  9. #19
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    2,027
    Thanks
    16
    Thanked 315 Times in 313 Posts
    Blog Entries
    13

    Default

    Like Dan said earlier (in the post that you 'officially' thanked) you can get the server to treat html pages as php with .htaccess - here's how to do that: http://www.besthostratings.com/artic...tml-files.html
    There are variations in the comments that you can try in case the solution in the main article doesn't work.

    Also, if you're unsure how to setup .htaccess, you literally just create a file called " .htaccess " at the root of your website amd paste in the suggested code.

    Hope that helps
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

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

    Default

    This is certainly possible; but it's usually not necessary. If you look at the site from a bigger perspective, the right answer is probably to create .php files instead. I don't really understand the reason you're avoiding it.... but... it's your site
    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

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
  •