Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Extras on Base Pages (Home, Archive, Contact, Sitemap) - For fresh installs  (Read 841 times)

nukpana

  • Hero Member
  • *****
  • Karma: 71
  • Posts: 663

This is the final version of this "fix".

This is for FRESH INSTALLS ONLY.  As a side effect, the base pages act like real pages, so they can be movable, editable, and deletable (@ your desecration) as well.

Ok let's start:

0. BACK THA Ffff.... Please backup your new install.

1. Insert into the database the following:
Code: [Select]
INSERT INTO `articles` VALUES(2, 'Archive', 'archive', '[func]archive:|:0,200[/func]', NOW(), 0, 3, '', '', 'YES', 'NO', 'NO', 1, '', '', 'YES', 'NO', 1, 'YES', 'NO');
INSERT INTO `articles` VALUES(3, 'Sitemap', 'sitemap', '[func]sitemap:|:[/func]', NOW(), 0, 3, '', '', 'YES', 'NO', 'NO', 1, '', '', 'YES', 'NO', 1, 'YES', 'NO');
INSERT INTO `articles` VALUES(4, 'Contact', 'contact', '[func]contact:|:[/func]', NOW(), 0, 3, '', '', 'YES', 'NO', 'NO', 1, '', '', 'YES', 'NO', 1, 'YES', 'NO');

The rest is in snews.php

2. Find the first line and comment it out, then add the second:
Code: [Select]
// $l['cat_listSEF'] = 'archive,contact,sitemap,login';
$l['cat_listSEF'] = 'login';

3. The next line, add (without the quotes) - "process, edit_comment".  We do this to capture 2 action urls not in the cat_listSEF
Code: [Select]
if (_ADMIN) {$l['cat_listSEF'] .= ',administration,admin_category,admin_article,article_new,extra_new,page_new,snews_categories,snews_articles,extra_contents,snews_pages,snews_settings,snews_files,logout,groupings,admin_groupings,process,edit_comment';}


4.  In function pages(), edit out the archive, contact and sitemap code like so:
Code: [Select]
// DISPLAY PAGES
function pages() {
global $categorySEF,$_No3;
$qwr = !_ADMIN ? ' AND visible=\'YES\'' : '';
$class = empty($categorySEF) ? ' class="current"' : '';
echo '<li><a'.$class.' href="'._SITE.'">'.l('home').'</a></li>';
// $class = ($categorySEF == 'archive') ? ' class="current"' : '';
// echo '<li><a'.$class.' href="'._SITE.'archive/">'.l('archive').'</a></li>';
$query = "SELECT id, seftitle, title FROM "._PRE.'articles'." WHERE position = 3 $qwr ORDER BY artorder ASC, id";
$result = mysql_query($query);
$num = mysql_num_rows($result);
while ($r = mysql_fetch_array($result)) {
$title = $r['title'];
$class = ($categorySEF == $r['seftitle'])? ' class="current"' : '';
if ($r['id'] != s('display_page')) {
echo '<li><a'.$class.' href="'._SITE.$r['seftitle'].'/">'.$title.'</a></li>';
}
}
// $class = ($categorySEF == 'contact') ? ' class="current"': '';
// echo '<li><a'.$class.' href="'._SITE.'contact/">'.l('contact').'</a></li>';
// $class = ($categorySEF == 'sitemap') ? ' class="current"': '';
// echo '<li><a'.$class.' href="'._SITE.'sitemap/">'.l('sitemap').'</a></li>';
if ($num) $_No3 = true;
}

5. In function extra, before the default: $print = false - add this: (the search-able line is the last 2 lines, don't add, please)
Code: [Select]
// EQ ADD
// Show up on the home page
case ($category == -3 && $page == -1 && $categorySEF == ''
&& !in_array($categorySEF,explode(',',l('cat_listSEF')))
&& !in_array($_GET['action'],explode(',',l('cat_listSEF')))
&& substr( $categorySEF, 0, 2) != l('paginator')):
$print = true;
break;
// EQ ADD END

default:

$print = false;

next post....
Logged

nukpana

  • Hero Member
  • *****
  • Karma: 71
  • Posts: 663

6. In function center(), comment out the archive, contact and sitemap functions
Code: [Select]
switch ($action) {
/* case 'archive':
archive(); break;
case 'sitemap':
sitemap(); break;
case 'contact':
contact(); break;
*/ case 'login':
login(); break;

7. In function archives, comment out the intial h2:
Code: [Select]
// echo '<h2>'.l('archive').'</h2>';
8. Follow for function site map:
Code: [Select]
// EQ Comment out
/* echo '<h2>'.l('sitemap').'</h2>
<h3><strong>'.l('pages').'</strong></h3>
<ul>';
*/
// EQ ADD 1 line:
echo '<h3><strong>'.l('pages').'</strong></h3><ul>';
$link = '<li><a href="'._SITE;
echo $link.'">'.l('home').'</a></li>';
// echo $link.'archive/">'.l('archive').'</a></li>';
$query = "SELECT title,seftitle
FROM "._PRE.'articles'."
WHERE position = 3
AND published = 1
AND visible = 'YES'
ORDER BY artorder ASC, date, id";
$result = mysql_query($query);
while ($r = mysql_fetch_array($result)) {
echo $link.$r['seftitle'].'/">'.$r['title'].'</a></li>';
}
// echo $link.'contact/">'.l('contact').'</a></li>';
// echo $link.'sitemap/">'.l('sitemap').'</a></li>';

9. In the new contact function (as of the July 14th version), find the first echo and comment the first html line and add the second:
Code: [Select]
// '<div class="commentsbox"><h2>'.l('contact').'</h2>
'<div class="commentsbox">

10. Find the first line, comment it out and add the remainder:
Quote
// echo '<option value="0"'.($edit_option != '2' ? ' selected="selected"' : '').'>'.l('all').'</option>';
         echo '
            <option value="0"'.($edit_option != '2' ? ' selected="selected"' : '').'>'.l('all').'</option>
            <option value="-1"'.($edit_page == '-1' ? ' selected="selected"' : '').'>'.l('home').'</option>
            ';

11. Find the first line, and add the second line below it:
Code: [Select]
$assigned_page = retrieve('title','articles','id',$r['page_extra']);
$assigned_page = $r['page_extra'] == -1 ? l('home') : $assigned_page;

This mod (fix), allows the base pages to act as real pages and allow the extras to show on them as well as on the Home Page.  The mod for existing installs is forthcoming.

fin.
Logged

nukpana

  • Hero Member
  • *****
  • Karma: 71
  • Posts: 663

Now, that I had time to think about it, this mod should work irregardless of a fresh install or not - untested of course.  The only thing that makes this for fresh installs is the IDs on the SQL.  Remove that or change it to the next incremental sequence and you should be good.

Again, untested.
Logged