What each file does

What each file does

Once again, the sNews CMS only has four files, and all of its content is stored in a MySQL database. We use these four files to separate functionality (the engine) from the design (layout) and content.

The snews.php file is where the magic of PHP takes place. It is a large file containing many individual PHP functions, each tailored to do a specific task. We refer to it as the sNews Engine, because each of the functions within it work together to create (dynamically) what we see through the index.php file.

The index.php file serves as the site’s template through which all dynamically generated content is displayed. This file contains the html skeleton of the site, and using PHP statements, connects to the content-generating functions within the snews.php file.

The style.css file (cascading style sheet) allows us to add style to index.php, the template file. Using CSS eliminates the need to use tables and cells which commonly make up HTML pages in WYSIWYG web page programs like Dreamweaver or FrontPage.

The .htaccess file may be very small but it is very important. Think of it as the central nervous system for your site. Without it, your site’s links will not function. When we create content and store it in the MySQL database, PHP creates its URL link structure, various parts of the URL are separated with symbols and characters. We have no control over this. But these links are not always as friendly to web search engines (like Google) as we’d like them to be.

We use declarations within the .htaccess file to re-write the PHP-generated URLs so they display without the symbols and characters, making them very Search Engine Friendly. It is important to make sure it is always included with your installation… or nothing will work.