The Easiest way to make Snews Themes
August 21st, 2008 in Tutorials
Introduction
Snews is a popular PHP CMS for its lightweight and simple themes designing. It looks like a blog system such as wordpress but it looks simpler .
You can design your theme using Adobe Dreamweaver Layout System or using a CSS based structure using DIV Tags.
A CSS based layout is better than a table based layout, because it looks more compatible with all major browser. There are many reasons that suggest you to use a CSS based layout, but this tutorial will explain to only how make Snews Themes.
Snews Theme making don’t require knowledge of PHP also if you will use PHP Tags in your theme. You will see how simple is making Snews Themes and how convert your actual HTML Layouts into it.
Making Theme
Snews CMS is a simple PHP file called snews.php, so you have to embed it in your index.php that will be your theme layout.
- Open your HTML Layout and rename it in index.php
- Add snews.php inclusion at the top of your HTML document
- Add header function between tags <head> </head>
A simple HTML layout with header function included (example 1):
<?php session_start(); include (”snews.php”); ?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<?php title(); ?>
<link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”rss-articles/” />
<link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”rss-pages/” />
<link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”rss-comments/” />
</head>
<body>
</body>
</html>
How you can see on example 1, we have added:
<?php session_start(); include (“snews”); ?>
This function will must be included in every your Snews Themes, otherwise your theme will not working with Snews.
<?php title(); ?>
This PHP Tag is used to display the page title Dynamically.
<link rel=”alternate” … href=”rss-comments/” />
These lines of code showed in the example 1, adds RSS feeds support into your theme.

In this Sample Layout we have four DIV Tags called respectively: “header”, “left”, “center”, “right” and “footer”. HTML code, between <body> </body> tags, should looks like this:
<body>
<div id="header">TITLE OF WEBSITE</div>
<div id="left">
<ul><?php menu_articles(nr, amount); ?></ul>
<ul><?php pages(); ?></ul>
</div>
<div id=”center”><?php center(); ?></div>
<div id=”right”><ul><?php categories(); ?></ul></div>
<div id=”footer”>CREDITS</div>
</body>
As you can see in the sample code, we have added some standard functions to show the main content of a page, links of pages, links of categories and links of articles.
<?php center(); ?>
Display the main content of a page.
<?php menu_articles(nr, amount); ?>
Display new articles. You can set “nr” and “amount”, where “nr” is the start number and “amount” is the number of articles to show. To display the first five articles you can set <?php menu_articles(0, 5); ?> .
<?php pages(); ?>
Display pages links.
<?php categories(); ?>
Display categories links.
There are also other functions to extend your layout!
<?php new_comments(nr, amount); ?>
It works as menu_articles but show a list of new comments.
<?php search_form(); ?>
Display a search form.
<?php breadcrumbs(); ?>
Display a set of links that show your position in site navigation structure.
<?php rss_links(); ?>
Display RSS links.









[...] It is the smallest CMS for Blogs. It runs in only one PHP file. Designing a theme for this platform is very easy. You can read more about theme making here. [...]
While this has been very, very helpful, I sure would love to see a tutorial in which we can load content dynamically. For example, I’d like to load the right sidebar based on the center content. I like to put ads in the right sidebar, but I don’t want to load the same set of ads every single time. I’d like to load ads contextually so that I can pull in a different file for the right sidebar depending on what I load into the center content area. Nevertheless, you’ve got me started, and I may think up the answer myself! Thanks a lot for the info!