News script bug fixes and OpenID planning

Sunday, 24 December 2006

It's 24th Dec, and here is the patch for version 1.3.2 of the news script. If you haven't ever used the custom publishing date feature or bothered about W3C HTML standard compliance, you wouldn't notice the problems :P

The concept of OpenID is so interesting that I'll probably implement it in the next major version of the news script, say 2.0, to provide multi-user support. I have already written a basic OpenID client, just for testing purposes. You can try it out here in case you're curious.

Posted at 01:12 am in PHP scripts, Testing

Comments

  1. Oh... unfortunly multi-user isn't implemented yet... one day one day... :)
    by N on Sunday, 31 December 2006, 01:07 pm #
  2. Hi,
    For your news system, I don't think you included the plugin for the flood protection (word filter like what you have right now for the comments) even though it was shown in the demo. Can you include it in the zip file?
    Thanks
    by Lucy on Tuesday, 16 January 2007, 04:59 am #
  3. If you mean the captcha then it's not available yet 'cause I want to test it a bit more.
    by NT on Tuesday, 16 January 2007, 06:29 pm #
  4. I really like it :) Did you create it yourself?
    by Lucy on Wednesday, 17 January 2007, 12:36 am #
  5. Yeah. I got the flash player from http://musicplayer.sourceforge.net/, though.
    by NT on Wednesday, 17 January 2007, 06:19 am #
  6. Is it possible for you to release a beta form of the plugin (or if it's not too much trouble send it to me)? I really like your news script and I don't want to switch to wordpress just to for the spam protection.

    Thanks so much!
    by Lucy on Friday, 19 January 2007, 01:00 am #
  7. Sure. You can get it here (http://winged.info/tmp/captcha.zip). Remember to read the README.txt file carefully.
    by NT on Friday, 19 January 2007, 06:06 am #
  8. There is title and body, do we have summary as well ? Then, we could display summary page with title and summsary, then full article when summary is clicked.

    Cheers, lovely script !
    by Sun Joo on Monday, 22 January 2007, 06:09 am #
  9. You could use
    [more=write your summary here]
    the post's body
    [/more]
    by NT on Monday, 22 January 2007, 08:57 pm #
  10. I have a small problem with the RSS feed. It isn't showing all the text in the news posts.

    Example News post and RSS feed

    Any advise?

    ps don't mind the language it is dutch :)
    by Marshal on Saturday, 3 February 2007, 10:10 pm #
  11. In rss.php, replace line 35
    $posts[$i]['MESSAGE'] = preg_replace(...
    by
    $posts[$i]['MESSAGE'] = $news->parseBB($posts[$i]['MESSAGE']);
    and you'd have the full post message.
    by NT on Saturday, 3 February 2007, 11:10 pm #
  12. Thanks, for your quick reply. Your solution works perfectly. Thanks again.
    by Marshal on Saturday, 3 February 2007, 11:26 pm #
  13. Hi, how can i change the title of the news pages? I want to make something like (post title - category title - main title)
    I tryed to do so but without success. Please help! Thanks, Avi
    by Avi on Monday, 19 February 2007, 08:46 pm #
  14. Hi, I use this wonderful script in my homepage but I have a little cuestion, after read a lot of times the instruccions cant friendly url work correctly. i am so dumb like a slice of ham ;P so how can i make it work properly?

    Thanks in advance.
    by R1p.PeR on Monday, 19 February 2007, 10:25 pm #
  15. Avi, that's not possible at the moment.

    R1p.PeR, if you've included the news script in your main index.php page then copy the stock "htaccess.txt" to your document root and rename it to .htaccess. Otherwise, try to look up mod_rewrite's information and follow instructions in the "htaccess.txt" file itself.
    by NT on Tuesday, 20 February 2007, 03:19 pm #
  16. Oh boy, dont work, so I'll take a closer look to fix that, thanks
    by R1p.PeR on Tuesday, 20 February 2007, 06:27 pm #
  17. I cannot seem to get it to display news. I can log into the admin fine. I can add news, but it won't display.

    Thanks for your help.
    by RBW on Friday, 23 February 2007, 04:40 pm #
  18. Follow the Usage section in README.txt
    by NT on Friday, 23 February 2007, 05:12 pm #
  19. Thanks for your quick response. I have been following the Readme.txt, but I am missing something that is causing the error. I cannot think or see what.

    Thanks
    by RBW on Friday, 23 February 2007, 06:59 pm #
  20. What's the error particularly?
    You just have to copy the code in the "usage" section into a page where you want to display the news entries, usually your "index.php" file.
    by NT on Friday, 23 February 2007, 07:37 pm #
  21. I have coppied the code from the usage into a page. When I go to that page I get the following:
    Fatal error: Call to undefined function: show_news() in /home/fhlinux174/s/samtownend.com/user/htdocs/index3.php on line 17

    Not sure why. Thanks
    by RBW on Friday, 23 February 2007, 08:35 pm #
  22. You should check out the examples in the "examples" directory. If they work then there's no problem at all. Try looking up the code in those files would give you an idea how to include the script properly.
    by NT on Friday, 23 February 2007, 10:03 pm #
  23. I have got it working now. Was not putting the address in right for the pathway to the news.php. Thanks for all your help.

    Great script
    by RBW on Saturday, 24 February 2007, 07:50 pm #
  24. Hi, your news is a good simple system and i will for sure put it in a site of mine.
    However i'm having trouble in validating RSS in feedvalidator.org. something about the charset
    ---------------------------
    Sorry
    This feed does not validate.

    line 12, column 179: 'utf8' codec can't decode byte 0x97 in position 539: unexpected code byte (maybe a high-bit character?) [help]

    ... dditional letters ? such as k, w, and z ? that were uncommon or missing ... ^
    In addition, this feed has issues that may cause problems for some users. We recommend fixing these issues.

    Your feed appears to be encoded as "UTF-8", but your server is reporting "US-ASCII" [help]


    line 12, column 157: description contains bad characters (2 occurrences) [help]

    ... Other versions have additional letters ? such as k, w, and z ? that wer ...
    ----------------------------

    I suppose the UTF solution i found in FAQ is only valid for display news but not for RSS???
    by Nuno on Monday, 26 February 2007, 01:17 pm #
  25. In "rss.php", around line 41, replace
    header('Content-type: text/xml');
    by
    header('Content-type: text/xml; charset=UTF-8');
    by NT on Monday, 26 February 2007, 02:59 pm #
  26. Thanks for the quick reply, i already tried to change the "<?xml version="1.0"?>" to <?xml version="1.0" encoding="utf-8"?> and didn't worked. But now the "Your feed appears to be encoded as "UTF-8", but your server is reporting.." gone with your sugestion.

    The "line 12, column 179" error keeps because during the post a "-" character (i did a simple test copy-paste of a wikipedia was transformed in a strange character. However in edit mode "-" apear normally but in news txt file have a strange char (a block). In the news display is showed as a "?". Maybe a problem of file being saved as ANSI?
    by Nuno on Monday, 26 February 2007, 03:45 pm #
  27. An add to previous post it seems the "—" is not the standard "-" but the longer "—" (alt+0151)
    by Nuno on Monday, 26 February 2007, 03:59 pm #
  28. That makes sense. In wikipedia, the en-dash was probably encoded as , which isn't a valid RSS entity, while the em-dash was , which is a valid one. More information here.
    Again, support for Unicode and special characters isn't very good in the news script's current version. I'll fix these problems in the new version.
    by NT on Monday, 26 February 2007, 07:13 pm #
  29. Thanks again NT. I will pay atention for unconventional chars for now since the choice of the "-" part was a (unfortunly) random choice. The essential that is the RSS feed is now validated with the right encoding. When online and up I will warn you about the site using your news system.
    by Nuno on Monday, 26 February 2007, 08:25 pm #
  30. Here's a simple problem for you. The current tab feature isn't changing when moving to a new page within the login area. Also, is there any status or ETA on multiple login users? I mean it's a thing of parsing users.txt page to confirm info and of course, a "Create a new user" section to the profile page, correct?
    by Jaylbird on Monday, 21 May 2007, 01:47 pm #
  31. Sun Joo(01/22/07) said: There is title and body, do we have summary as well ? Then, we could display summary page with title and summsary, then full article when summary is clicked.

    Cheers, lovely script !

    If I may, I found that if one will comment out line 145 of functions.php, you will get a simple "summary" of the date/time and subject line.

    Looks like this:

    //$details[$count]['MESSAGE'] = htmlspecialchars(stripslashes($message), ENT_QUOTES);

    I hope this helps.
    by Jaylbird on Monday, 21 May 2007, 05:00 pm #
  32. The tab thing is just for decoration, so I didn't bother to code it. This helped make the template files cleaner as well.
    Having multiple users would require different access privileges, while I initially wrote the script for personal use, adding this feature to the current code base would create a big mess albeit it'd work.
    Version 2 will have lots of changes, probably will be rewritten a bit as well, so it'll take time. No definite release time yet.
    by NT on Monday, 21 May 2007, 06:28 pm #
  33. great script but i want to do the following but since i have no php skills....

    i want to use the script for both my news pages and my blog pages. i have set up 2 categories news and blog, now i can display the latest posts from a particular category no probs but when i click on the archive links at the bottom it displays posts from both categories. obviously if i'm on the news page for example i just want posts from the news category to display. is there a way of displaying archived posts from a particular category?

    would appreciate any help, thx in advance
    by Hung on Saturday, 26 May 2007, 12:58 pm #
  34. That's not possible, unfortunately.
    by NT on Saturday, 26 May 2007, 02:52 pm #
  35. ohh thats a shame, maybe in the next release then? guess i will have to install the script twice, once for each page if u know wot i mean.

    another question is it possible to have external links open in a new window rather than in the same window, i'm using an iframe so i dont want external pages opening in that iframe. i've been using html and surrounding it with [raw] tags which works to get external links to open in a new window but i need a simpler way of doing it.

    thx
    by Hung on Saturday, 26 May 2007, 04:12 pm #
  36. In functions.php, look for function parseBB(), and add a new BBCode tag and its corresponding HTML code which should be very similar to the predefined "url" tags.
    by NT on Sunday, 27 May 2007, 01:26 am #
  37. Hi, lovely smart news system!
    Can't wait to try it but... I do not seem to be able to login w demo/demo! It says 'wrong user or password'.
    How do I fix it?
    Thank you!!!
    by Tofu on Sunday, 17 June 2007, 01:17 pm #
  38. After I type an [enter] i get two line breaks instead of one. See also comment

    Have you been able to find a way to solve this?
    by Marshal on Sunday, 17 June 2007, 10:59 pm #
  39. Tofu, the new version 1.3.4 should solve your problem.
    Line-breaks are different on different platforms (see my reply here), while I wanted to keep the paragraph formatter simple, so I didn't take this into account. Version 1.3 is pretty stable now; that's why I don't want to make too many changes to it. The upcoming version 2 will have this problem resolved.
    by NT on Monday, 18 June 2007, 06:51 pm #
  40. Oke, I will just wait for version 2. Script is still great :)
    by Marshal on Monday, 18 June 2007, 07:07 pm #
  41. Thank you so much for the news script. ¿Have you think about add an image attachment to it in the future?
    by Andrés on Friday, 10 August 2007, 05:03 pm #
  42. Hi!
    Your new script is great! Thanx a lot!!!
    You might add an option there someday to create short-news to display on the main page. Good luck!
    by Serge B on Tuesday, 6 November 2007, 08:19 pm #
  43. Captcha doesnt work on my site.
    by Ripper on Tuesday, 20 November 2007, 08:10 pm #
  44. Hello everybody!
    I have a question about the news script. I am searching for the file where the date of the post is storde to change them after posting news. I would like to update a website with existing news post in an old system, now I would like to give the news the original date when they were posted. As this seems not to be possible in the admin-area I would like to change this manually after posting. Is this possible in any way?

    And by the way... nice script!
    by Chill on Tuesday, 15 January 2008, 04:49 pm #
  45. The posts are stored in /news/data/posts/year-month.txt.
    You need to use the mktime function to make the time for the posts.
    by NT on Tuesday, 15 January 2008, 06:33 pm #
  46. Hello NT!

    Thanks for the quick response. I tried changing the timestamp manually in the txt file. It worked, but just as long as only the time changes but not the date. As soon as the timestamp is changed too much, the post disappears from the output-site and there is now a new entry in "Uncategorized".
    I don't know what do to with the mktime function, is it possible to change the date of a post after publishment with this function?
    I searched php.net for this function but it didn't helped me...
    Regards
    Chill
    by Chill on Tuesday, 15 January 2008, 10:53 pm #
  47. There's no automatic way to modify the post's creation time in the control panel. That's why you have to edit the txt file manually.
    The timestamp is in seconds so you should be able to work out the previous date. If the date you want is in a different month or year, you have to copy that post with the modified timestamp to the corresponding year-month.txt file.
    by NT on Wednesday, 16 January 2008, 12:17 pm #
  48. Hmmm... so I tried everything but i doesn't seem to work. It is not even working if the timestamp is changed by 1 day (86400) and the post remains in the same month. I tried additionally to make a .txt named 2-2008.txt with a post dated February 14th 2008, but the only result was a new entry in "Uncategorized" which is not displayed in any way.
    by Chill on Thursday, 17 January 2008, 09:53 pm #
  49. Ok ok my fault... I found the mistake. I just tried any dates and didn't notice that the problem was the dates all were in future. I now tried one in december 07 and it worked perfectly. Thanks for your support, great project!!
    Greetings from Germany... Chill
    by Chill on Thursday, 17 January 2008, 10:04 pm #