Useful Resources for sNusers

Print This Page
Pages:  Main  Adding Content  Template Structure  HTML Entity Conversion
Utilities:  HTML Entity Converter
Styles and Designing:  CSS Resource Links
Templates:  sNews Templates
Templates Ported with sNews 1.5-rc3:  GoFlexible
Adding content to sNews

Adding Content

Most open source CMSs (content management systems) use a MySQL database to store and retrieve content entered in through textarea panels. This information may be submitted to the database in many ways. Where sNews 1.4 is concerned, content is submitted by the site Admin through the New Articles and Categories Admin Panels, and by site viewers through the Article Comments Panel. As is the case with all MySQL-based CMSs, we must pay particular care as to how we copy and paste content into the textarea panels.

Perhaps you've decided to use sNews to power your site and you have a large number of articles you need to import from an existing site. Or you have a lot of content already saved in MS Word documents, ready to import into sNews. The quickest way is to copy and paste content from your source files into the New Articles Admin Panel. If you are accustomed to copying and pasting content from an MS Word document file, for example, you don't want to do that with sNews. If you do, your article will not display. You will also experience mysterious problems if you copy and paste pre-formatted content from a WYSIWYG web page application like MS FrontPage 2003.

What causes this problem?

When content is placed (and saved) in an MS Word document (as one example), the document's formatting is created by code we cannot see. When you copy the content directly from an MS Word document, you also end up copying the associated format code along with it. And, when you paste that into the New Articles textarea, the format code goes with it. When the article is saved, it is stored in the articles table in your MySQL database. The problem emerges when you save the article... sNews automatically applies paragraph tags (HTML p-tags) to every line-return in the article's content so that it will display properly in the sNews template (index.php). This conflicts with the hidden formatting code already attached to the content. The article may display in a distorted fashion or... most likely... not at all.

The Solution

We want our content to be in a raw text format... free of any formatting before we copy and paste it into the New Articles textarea. If your content source is preformatted - as is the case with content in an MS Word document - we start by copying and pasting it into a Microsoft Notepad file. Notepad does not add or interpret formatting code, so this automatically removes any that may be associated with the content. The same applies in any Operating System, provided you use a raw text editing application. If necessary, you can break the text into paragraphs and space them out. Nothing more is required. If you must save the file somewhere for future editing and re-use, do so. Then copy and paste your content from this source... into your New Article textarea box. Once saved, sNews will then store it in the database table with the p-tags automatically included, and it will display properly to site viewers.

Custom Formatting article content

One of the little-known features of sNews is the ability to use your own customized HTML formatting within article content. When you are creating a New Article, you will notice the Auto Paragraph check-box - above the Category Drop-down is checked. When this is checked, sNews automatically adds the p-tags to all paragraphs in the content you enter into the textarea box. You can, however, switch this feature off if you wish to pre-format your content in the textarea with HTML tags.

This approach is useful when you want to apply specific styles to a specific article... styles that are not defined in your site template .css file. For this site (, we created a second stylesheet.css file with custom styles that we use only for article content. We saved this new file in the images folder. We then added another stylesheet file-path link to the new file under the existing link-line in the index.php file, so our new styles will apply to any content displayed within the site template.

For instance, you can use span=class style-tags to color your text blue and add b-tags to make it bold, and change it to red or green or orange or grey or whatever color you want to use. You can also wrap sections of content in customized containers... use custom heading styles... image backgrounds... and just about anything else you can style in a stylesheet.