FRDK Design & Kommunikation

Installing sNews

This info was originally written for sNews 1.5, in December 2006, and split over two articles. I have updated it a little for sNews 1.6, though most of the details are the same for both versions. Furthermore, it assumes that you’re using a Mac, running OS X (10.2.8 or better)

Local Installation

In order to get to know sNews, it’s recommended that you install it on your local machine first and do a few test runs, before putting a site on the web. The best way to run sNews —or any database driven CMS— is to use a dedicated local server application, rather than the built in features in Mac OS X. It’s so easy that anyone can do it.

The MAMP

The local server application for any Mac is the MAMP. MAMP stands for Mac Apache MySQL and PHP. Apache, MySQL and PHP are the industry leaders in their respective field, as well as open source applications. And the Mac is the most user friendly computer and operative system platform out there. As you already know.

So the first step is to download the MAMP and install it on your computer. There are three packages available, one for PowerPC Macs, one for Intel Macs and of course one Universal package. Choose the one that fits your machine or use the Universal install if you're uncertain. The installation process itself is simple and self-explanatory, just follow the instructions on screen.

MAMP Structure

There are a couple of details that are important when using MAMP. The first is editing the Apache httpd.conf file to enable mod_rewrite and set correct override permissions. The second is understanding the file hirearchy.

When you start a new project for local development, make a folder for it within the htdocs folder inside MAMPs application folder — or the folder you have defined as your root folder in MAMPs settings. The htdocs folder (or custom root folder) equals the local server root. When you use your web browser to view local projects, you input the address http://localhost:8888/project-folder-name/ where "localhost:8888" tells MAMP to look in htdocs for your "project-name-folder".

So, MAMP is up and running. Now for the sNews installation.

Preserve the original

You’ve downloaded the sNews zip file from snewscms.com and signed up with the friendliest support forum on the InterWeb, right? Then take a couple of minutes to read through the readme.html file in the unpacked sNews folder.

Now, before you start modifying the php files it’s a good idea to make a copy of the sNews folder to your local server root folder, and give it a project name. That way you will have an untouched original folder to go back to if things start to go haywire.

Next we look at the details of the sNews files.

You are recommended to use a good text editor for this work, which means an editor that does not add excess or proprietary code, an editor that allows you to create and edit code in a wide variety of modes and that lets you do things like regex find and replace, display line numbers and coloured syntax. “Good editor” automatically excludes Dreamweaver, FrontPage, Word and in a sense Apple's own TextEdit. Examples of good Mac editors are BBEdit, Coda and similar.

Creating the database

When you were reading through the readme.html document, you probably noticed the many lines of code in it. That is the default database information you need to create an sNews database (sNews will not function without it). Here’s what you want to do.

Open readme.html in Safari (or, ehm, other browser), find, select and copy the database information. Make sure you select everything from the first line of CREATE TABLE articles to the last semi-colon of the last INSERT INTO settings VALUES line. Then go to your text editor, make a new document and paste the code. Save this document in the original sNews folder[1] as for example snews15db.sql.

Start up MAMP (if it’s not already running), make sure that your servers are running, then click “Open Start page” and browse to phpMyAdmin. Type a database name in the field labelled “Create database” and click “Create”. When the database has been successdully created, click the “SQL” button and paste the code you copied earlier into the textarea at center page. Click “Go” to populate the database, which is the end of step 1. You can now close the browser window if you like.

Step 2: Setting up .htaccess

The .htaccess file contains link processing directives which are necessary in order for sNews’ SEF links[2] to work as intended. When you put the sNews installation on a server root you will normally not have to edit the .htaccess contents. However, if you use a subfolder for the sNews installation—like your project folder is a subfolder of your local server root—you must edit the .htaccess file. This can be slightly problematic on a Mac. Why? Well, because Mac OS X thoughtfully hides files with names that start with a period (.) – those type of files are considered reserved for system use only.

How do you edit a file that is invisible? Answer: the application developers provide you with a copy of the file in a read/writeable format. Look in your projects folder and you will find a file called htaccess.txt. Open it in your text editor. Find the line that says:
#RewriteBase /sNews16
and change it to read:
RewriteBase /your-project-folder-name

Save htaccess.txt to retain the changes and then Save As .htaccess (without file ending). The system will warn you that files starting with a dot are system files (click OK to save with a dot anyway) and that a file already exists with the same name —the invisible version. Click OK to overwrite the existing, invisible .htaccess file. When that is done, close the file and open snews.php (in your project folder).

1. Why save in the original folder? So that you won’t have to dig into readme.html every time you need to set up a new database. In fact, you don’t need to copypaste either, simply choose to import this snews15db.sql file into your database and the info will do its magic, automagically as it were.

2. SEF links, or Search Engine Friendly links, are links that are easy to read and understand for both human and machine. Example: http://frdk.com/snews/snews-setup-local/ is a SEF link whereas the true link, http://frdk.com/snews/index.php?category-id=installation&article-id=snews-setup-local, isn’t very friendly.

Setting up snews.php for local use

In snews.php, go to approx. line 16:

$db['website'] = 'http://localhost/sNews/';
and change it to the address of your project folder, which will typically look like this (when using MAMP):
$db['website'] = 'http://localhost:8888/project-folder-name/';
and take care to include the trailing slash, unlike in .htaccess where it’s not needed. In snews.php it is needed.

Next, on approx. lines 18-21 you input a) the name of the database you created earlier, b) the username and password for the database (usually ‘root’ in both places) and c) the prefix you want to use – prefixes are useful if you plan on creating more than one site with separate content but only have room for one database. If you’re unsure, simply leave the prefix field empty.

Congratulations! Your sNews system is now ready for content creation on your local server. Once you've done this a couple of times, doing the same on a web server will be easier.

HomeBlog » sNews » Installing sNews

▾ Flip Extras