UPDATES AT BOTTOM OF POSTALL OF UPDATES ARE INCLUDED IN ZIPED FILE, YOU DO NOT HAVE TO CHANGE FILES FROM UPDATE SECTION AT BOTTOM, IF YOU DOWNLOADED ZIP FILE AFTER 16 JUNE 2007 
Hello

,
Some time ago
I asked on forum for modifacation of sNews, which I found on Mika's page. He did not answer in that thread, so I decided to do some 'hack' (big word for my work;) ) and do it my self. I did this by saturday night and sunday morning, I am not php programist, so be understing for my 'hacked' version

. I was tried to make it easy to use and maintain (in philosophy of sNews) and not interfere to much ( I'm not writing here about code :cool: )in main functionality of this great CMS.
I take snews.php 1.6 with philmoz modifacation
Articles sorted by categories. I choose modificated version by philmoz, because this admin feature in my opinion is very importent and usuful, especialy in big sites and in my mod helps keep easy maintaining articles and subpages.
Here is zip with three files:diff, orig snews.php (with philmoz mod), and modified snews-split.php (this is what You
probably need most).
My mod need one new table in databese, and one new column added to table articles:
CREATE TABLE subarticles (
id int(11) primary key auto_increment,
article_id int(11),
page_number int(11),
title varchar(100) default NULL,
seftitle varchar(100) default NULL,
`text` longtext
);
ALTER TABLE articles ADD COLUMN subarticle bool;
and styles to style.css:
.current-sub-number {
color: green;
}
.current-sub-menu {
color: blue;
}
.sub-menu {
float: right; margin-right: 10px; padding: 10px;
}
.sub-number {
color: black;
float: right;
margin-right: 50px;
margin-left: 40px;
}
In .htaccess add 2 lines:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z_]+)/([^/]+)/([^/]+)/ index.php?category=$1&title=$2&subtitle=$3 [L]
Copy the file snews-split.php to the directory, where You have snews and change first line in index.php:
<?php session_start(); include('snews-split.php'); ?>
In editon of article (or when adding new one) in
customize You will see new option:
Display subpages of article.
When You turn it checked, in articles listing appear link to adding new subpages, and if there are any added subpages You also will see link to editing subpages with its number.
Order of displayed subpages in menu is by page number, which You provide adding new subpage.
Always first subpage of article is main article

, that is next subpage should have page number = 2 and up.
Menu in top left in article, and numbers of subpages (at the bottom of the article) shows when "Display subpages of articles" is checked and You click "continue reading" or article title.
I tested it on standard snews template, If You found any bugs, problems write at once

.
UPDATE #1fix for deleting subarticles:
find in line 1554 in snews-split.php
echo html_input('submit', 'delete_article', delete_article', l('delete'), '', 'button', 'onclick="javascript: return pop()"', '', '', '', '', '', '', '', '');
and change it to
echo html_input('submit', 'sub_delete_article', 'sub_sub_delete_article', l('delete'), '', 'button', 'onclick="javascript: return pop()"', '', '', '', '', '', '', '', '');
UPDATE #2 - I think not last...
Fixed deleting subpages together with main article:
After line 1866 in snews-split.php:
mysql_query("DELETE FROM ".db('prefix')."articles WHERE id = $id LIMIT 1;");
add line:
mysql_query("DELETE FROM ".db('prefix')."subarticles WHERE article_id = $id;");
UPDATE #3In few places in sql statemants I forget to add
. " db('prefix') " .. I don't write all of this lines here, instead I updated ziped file
UPDATE #4I added "new subpage" link in editing main article (with info about number already added articles).
This what You have to modify (all changes are made in snews-split.php):
Add two lines in function l:
$l['number_of_subpages'] = "Number of already added subpages: ";
$l['no_subpages'] = "No subpages added yet";
Find line 1397 in snews-split.php:
echo html_input('button', 'include', '', 'Include', '', 'button', 'onclick="tag(\'include\')"', '', '', '', '', '', '', '', '');
and after this line add:
if ($frm_display_subpages == 'ok' && !empty($id)) {
echo "
<a href=\" ". db('website')."index.php?action=sub_article_new&id=$id\">" . l('new_subpage') ." </a> ";
number_of_subpages($id);
}
Under the function form_subarticles add one new function:
function number_of_subpages($id) {
$r = mysql_fetch_array(mysql_query("SELECT count(*) FROM ".db('prefix')."subarticles where article_id='$id';"));
if ( $r[0] > 0 ) { echo l('number_of_subpages'). "<b>$r[0]</b>"; }
else { echo l('no_subpages'); }
return 0;
}
UPDATE #5I made changes in form_subarticles - fixed return to editing *NEW* article (and not to editing existing) form when where errors (existing title, page number, seftitle).
UPDATE #6I modified functions sitemap() and breadcrumbs() to display subpages, and function search() to search strings in subpages.
UPDATE #7Unique title (and seftitle) only in article, not in all subarticles table.
UPDATE #8Function delocalize() is in Polish.
Ziped file from top of post contains all all of above updates and most actuall diff file.
Regards
skidoo :cool: