What sNews hacks or mods would you like to see?

What sNews hacks or mods would you like to see?

I love sNews CMS. Seriously, I love it, I've used damn near everything over the last 8 years, from a custom built Perl/MySQL system to the ever popular WordPress. What makes sNews so special? It's small, contains the basic functions I need to run a blog/cms, and leaving the rest to me to "hack" or "mod" it as I deem necessary.

There are several areas in which I've already made changes, such as the pretty date and comments mod, the tags mod, and the social bookmarks mod. I'm not done yet, I think the entire search function needs a make over, for one thing, the current function uses the MySQL LIKE operator for matching, this just won't cut it once you've got a years worth of articles piled up in your system.

The fix? Use MySQL's Full-text search, it's simple to implement on any existing database, has a great default list of stopwords, and relevance. We can then create an advanced search form to allow proper boolean operators; something like the search form shown below, from one of my other sites.

One of the biggest tricks I will want to work on is to use the post method... taking the post variables submitted and then format the URL to make it SEO/bookmark friendly, i.e. if your search form submissions contains the words snews updates the URL would appear as http://www.mdj.us/search/snews/updates/. This will take the most of the effort and modifications.

So, that's the next big mod that I will want to tackle at some point in time, what about you, what's the top mod you'd like to create or see created?



You might like


Hi, Mdj...

Patric from sNewscms.com here... I agree about the searchfunction. Can't wait to see what you do with it ;) And the title itself "What sNews hacks or mods would you like to see?" Whuhaaaa, I could answer that, but I'm not sure you would appriciate the long comment ;)

Would be awsome if, when ready with your enhancements of sNews, you could post the entire, commented, snews.php somewhere at the forum...

Thanks for being a valued part of snews.

Thank you Patric, I'd love to hear your thoughts. I'm just trying to get a feel for what people want to do with sNews. As you know I enjoy hacking around in sNews and if I could help other users at the same time, that's even better.

Once I get around to tackling the search function, I will definitely document it and make it available for public usage. I have some smaller hacks that I'm going to do first however :)

How about a "related posts" mod? Any interest out there for something like that?

My one major complaint about sNews - when I have to compare it's use to other systems - say Wordpress or Textpattern, is the inability to use simple tags to pull out specific information from the database to display where I want to in a html template. Sure the Extra/Includes function in 1.7 is awesome and a step in the right direction, but for example, if I wanted to display just say the title, intro text, publish date and comment count (or any variation of that) from one article in a special div or something there is no way to do this easily in sNews, where as in the systems I mentioned or even a old flatfile cms like cutenews you could do something like this very easily. I mean, if I'm running a feature driven site and I always want a particular article with intro text to be in a specific div, I can't do it...

I used the RSS function to parse this out in 1.6 in a web project, but I'm frustrated I don't have this ability in sNews natively.

To me the best thing about a cms is the ability to pull whatever information I need out of the database and to place it where I want in the design. sNews for everything that I love about it, missed this functionality. I'd like to see something that addresses this, since you're asking...also the Body ID mod for 1.6 to be workable with 1.7 would be great. Lots you can do with CSS and display:none in terms of layout if you have a body id...

great work though man...

Brian, I hear what you're saying, when I decided to bring this site back as a blogging/article-type site, I went on a long search for the right software.

I'm pretty happy with the base layout of sNews actually, I just made some changes in my snews.php, but honestly, right now WordPress is probably the better solution for the majority of people out there that are "blogging". It's included in most every Web Host's auto-install software for one thing, so you don't even need to know a lick of PHP or how to set up a MySQL DB.

The way sNews handles articles... it just spits it all out, makes it much easier for "newbie" designers and such, whereas a WordPress template file can require a fair amount of PHP, sNews is just a single index.php and a few function calls... but it lacks flexibility for designers. I that don't mind echo'ing out a few tags in a loop to position the content where I want. I mean, the default "infoline" string of comments / date is horrendous, hence my "pretty comments" mod. It really limits a designer from doingm everything he or she can with the system.

That being said, that's also one of the reasons I like sNews so much, it's a base platform, performing just what's needed, and I can take it and hack it up to do exactly what I want it to.

To do what you're asking about extracting data from a single article wouldn't be too difficult, I would just write a new function to get all the fields from an article based on an ID that it has been passed, then you can output what you like, that's basically what you did by using the RSS function. However, changing the default articles function to provide a WP style loop would require some thinking and coding.

It should be done though at some point, maybe I'll give a stab at it some time... I'm such a glutton for punishment, heh...

I agree with you about what a good base platform sNews is. I'm primarily a front end designer and am at home in photoshop/illustrator and xhtml/css and a bit of javascript. sNews really doesn't make me have to think to much when I design, or at least it makes me think in ways that I am accustomed to thinking. While I love the finctionality of say wordpress I hate the templating/theme system. I don't want "themes" or "templates" I have code. Period. That's what I love about the single index file in sNews. Of course it's also limited, but I'd rather get around those limitations with the css rather than little template includes all over the place...

As you said - "To do what you're asking about extracting data from a single article wouldn't be too difficult, I would just write a new function to get all the fields from an article based on an ID that it has been passed, then you can output what you like..."

That's essentially what I'm looking for really with sNews. I'm assuming you'd have to pick it out with a identifying category number and/or article number and some kind of Y/N in including title, intro text, date, comment number... something like
<php include "(category 1) (Article 2) Title Y, Intro N, )....etc...I'm not a php guy so the syntax escapes me...but just a native standardized sNews tag/variable system like this would just open the system up completely in my eyes..and it doesn't seem difficult, although I'm not sure of how easily it's done given the architecture of the single snews.php engine...

Yeah, I'm from the other end, though I can find my way around PhotoShop, I've been using the GIMP for a couple years now, much cheaper to upgrade ;)

I come from a primarily Perl background, but PHP is pretty easy to pick up I must say. Yeah, WordPress just looked way to heavy for what I wanted, at least right now.

You know, I'm not sure right off hand the absolute best way to implement what you want, at the most basic level, for an article you could have a function select the articles contents into an array and then you just echo the fields, a la $article[date], etc where you want them. Yes, you'd need to pass it the ID of the article so you'd know what to select, unless for instance you always want say, the most recent article or something.

"What sNews hacks or mods would you like to see?"

"Related posts" would be great :)

Also I would like "subscribe to comments via email\", that is a great to keep those who have commented updated on new comments on the page/subject.

"Subscribe to comments via email" is not to complicated to make, but I am still a php noob and are "no good" with sql... There is also a lot of small comment scripts out there that could give some examples on how to do this. I guess something like this:

1) Comment is sent and "subscribe to comments via email" are clicked.

3) Email is registered and are marked with "awaiting confirmation"

2) An email is sent from the server, asking for confirmation (an url with a id and a unique string).

3) If it is clicked/confirmed, server sets status to "confirmed"

4) Every time a new comment is added to that blogpost/article, an email is sent to confirmed subscribers.

I often comment on old articles I find interesting, sometimes weeks later I receive email that new comments have been added (and I visit again). Its a great tool :)

One small additional wish, sometimes I find a blogpost to be "outdated". Then it would be great to be able to be able to stop new comments on that page (but still display old comments). I cant find a function like that in sNews

Hi Sven, this is great feedback, I love the idea of an email subscription to a specific article's comments, that is very useful. Should be fairly easy to code as well.

For the second suggestion, you can freeze comments in an article, but there is no setting to do it automatically once it reaches a certain age. That one shouldn't be too difficult to do either, unless you want to set a different specific age for every individual article, then that would take a good bit more coding.

Also, I noticed you've already discovered my related articles plug-in. I plan on refining that even further (ranking title to title higher, not just keywords within titles,etc).

I'm currently working on a new design, and my wife is in the hospital recovering from some minor surgery (she's fine thanks), so my time is VERY limited this week, but I will definitely look into implementing the 2 ideas you suggested.

Thank you Matt.

Sure, family and friends should always come first (good to hear thats your wife is fine). After all, you asked for suggestions, then "php noobs" like me pop up with a wish list ;)

The freeze comment after certain date /age is not that important.

A more visitor oriented thing would be to have sNews to send a email thanking for the comment when there is a new email address used (compared to all emails for all comments/posts). I think that would be a attractive add-on, like wishing new ones welcome and hope that they will come back and visit again and maybe leave another comment.

Have a nice week Matt

No worries, I appreciate the suggestions, I was actually getting worried not many people were using sNews as I wasn't getting many suggestions, lol.

We're in total agreement about the comment email function, that should definitely be added.


An integrated poll would be a pretty cool mod too.

Matt: "I was actually getting worried not many people were using sNews..."

I love small scripts that just "do the job". sNews appeared to be such a useful script.

I had been preparing sNews for a site that have ordinary static files and folders, but when I added sNews htaccess-file it messed up the whole site. So I have to drop sNews for that project, but I am planning to put up a new site and use sNews there.

Yeah, sNews is just about the perfect base for me to do what I need to for my personal site here, although I do have a financial incentive to use WordPress now, so I'll probably start doing some work with that blogging system as well.

Hmmm, what was the .htaccess doing to the site? You can change and/or add rewrite rules if needed.

Matt, I agree with you partly.

I think sNews is capable to do almost the same as WP, well the basic stuff anyway. WP is a "monster"!

For my last "try" to upgrade to a cms/blog I installed both sNews and WP, after adding all addons and stuff, WP was huge, a bit slow and used almost 8 MB disk space. sNews had 3 php files and took about 0,3 MB.

I ended up deleting WP, sNews did the job (but are missing some of all the extra stuff that WP have via addons).

The problem with the htaccess was that is was to "wide", it tried to send all traffic to sNews. I could manage with only a few categories (you have 6), so if there was some kind of way to only direct those to/via sNews, and leave all other request to the normal (mostly static) files on the the server, that would have "saved me". Example (remember I am a noob):

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(CSS|Gaming|Netbooks)(.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(CSS|Gaming|Netbooks)(.*)$ index.php?category=$1 [L]

IF that code was correct (and it not working here) it would tell to direct only url-request starting on of these three categories afte the domain name: "CSS", "Gaming" or "Netbooks" - all other request should go elsewhere (or give an ordinary 404 if not found).

But is it possible?

Yeah, WP was too big and unwieldy for me too, but it's place as the #1 blogging platform means I will be working with it, so I've got to deal with it, but mainly as an administrator and designer, I won't be hacking around in it I don't think.

Hmm, your code looks OK at a glance, but the static files should be served using the basic rules included with snews, i.e, this rule

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*) $1 [L]

should check if the request is for an actual file and serve the file if it exists, so you shouldn't need to add any specific categories.

Well, for work we got to accept what the boss/client wants. And it sure is a popular platform.

Thanks Matt, I will give it another try this weekend. It will save me a lot of time if you htaccess suggestion works :D

Yeah, no doubt, WordPress's benefits from a large and active development group behind it, and has an active theme/plugin community. sNews seems like it's pretty sluggish as far as development goes, and the themes are a rarity.

Oh well, it works well for my needs right now.

Let me know what kind of errors you have with the rewrite rules if you run into problems and I'll try to assist you.

hi matt...

i want to ask , how to add gravatar into snews1.7 comment, thanks :D

Hi there wangsakarsa,
I've just recently added that to my "to-do" list as I've gotten a few requests on it, so I will be definitely be writing a tutorial on it at some point. Sorry I don't have a time frame yet, the best I can say right now is to keep checking back every so often or subscribe to my feed for updates.


Any idea how to add the extra blank space in text -- the "& nbsp;" after a period to make it easier to read?

By the way, Great site.

Hi Steve,

I'm a little confused as to what you're asking about, are you referring to a specific mod or function within sNews?


Ahhh, I gotcha now Steve I think, you want multiple non-breaking white spaces in regular article text?

Hmmm, I've never really thought about it or had a need for it. When I want to preserve white space like that I'll use the &nbsp; entity, or the pre tag, like for my code samples.

I'll have to think on that a bit.


That's exactly what I mean (sorry about the confusion)

Whenever I use the " " tag -- it shows ups. It doesn't in the preview, but it does in the article or page.

Thanks for your time.

Comments are closed. No new comments allowed.

Copyleft 2002 - 2017 Matt Jones
Hand crafted with HTML5 & CSS3
↑ Back to top