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.

Pages: [1] 2

Author Topic: Extra Bug fix testing  (Read 5955 times)

centered

  • Guest
Extra Bug fix testing
« on: November 26, 2008, 04:56:41 am »

This is to fix the bugs noted here: http://snewscms.com/forum/index.php?topic=7995.0

Quote
Bug 1: Extra is not selectable for Home, Archive, Sitemap, Contact Page.
Possible Solution - Don't allow hard coded pages in sNews.  Make Archives, Sitemap, and Contact Page a Page through the system, not the script (if that makes sense).

Bug 2: (would be fixed in the solution above) User Page created with Extra selected to show on all Pages, will only show on User Page, no other.

Gotcha - Home (in sNews sense) is not a page. This does not include making a current page a home page.
Possible Solution - Possibly make "Home" Position "0" and allow it to be selectable in the Pages dropdown list for Extra Content. Have case in function extra to show on home page (position 0)

Bug 3: Making User Page as Home Page, with Extra selected to show on all Pages, will not show on new home page.
Possible Solution Make case along with Home page (position 0), to show if defined as User Home page

Effects Database and snews.php:

Step 1.  Database:
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');

Step 2.  Find the first line, comment it out as shown and add the second line - Pretty much removing Archive,Contact,Sitemap
Code: [Select]
// $l['cat_listSEF'] =  'archive,contact,sitemap,login,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';
$l['cat_listSEF'] =  'login,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';

Step 3. Replace function pages with the below, or comment the lines shown:
Code: [Select]
// DISPLAY PAGES
function pages() {
// EQ edit
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;
}

Step 4. In function extra, add this before the $sql:
$dpage = s('display_page');

Not needed

Step 5.  In function extra, before the default: $print = false - add this:
Code: [Select]
// Show up on the home page
case ($category == -3 && $page == -1 && $categorySEF == ''
&& !in_array($categorySEF,explode(',',l('cat_listSEF')))
&& substr( $categorySEF, 0, 2) != l('paginator')):
$print = true;
break;
// Doesn't not show under categories or pages
case ($category == -3 && $page == -3):
$print = false;
break;

Move to the next post...
« Last Edit: November 29, 2008, 10:27:49 am by equilni »
Logged

centered

  • Guest
Re: Extra Bug fix testing
« Reply #1 on: November 26, 2008, 05:07:01 am »

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

Step 7. In function archives comment out:
Code: [Select]
// echo '<h2>'.l('archive').'</h2>';
Step 8. In function sitemap, comment the lines shown:
Code: [Select]
// echo '<h2>'.l('sitemap').'</h2>';
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>';
echo '</ul>
<h3><strong>'.l('articles').'</strong></h3>
<ul>';

Step 9. In function contact, comment the first line and paste the second
Code: [Select]
// echo '<div class="commentsbox"><h2>'.l('contact').'</h2>';
echo '<div class="commentsbox">';

Step 10. Comment the first line and add the next lines:
Code: [Select]
// 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="-3"'.($edit_page == '-3' ? ' selected="selected"' : '').'>'.l('none').'</option>
<option value="-1"'.($edit_page == '-1' ? ' selected="selected"' : '').'>'.l('home').'</option>
';

Fin
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: Extra Bug fix testing
« Reply #2 on: November 28, 2008, 03:10:51 pm »

Does the first value matter? Cause I get this error:

Quote
Error

SQL query:

INSERT INTO `articles`
VALUES ( 2, 'Archive', 'archive', '[func]archive:|:0,200[/func]', NOW( ) , 0, 3, '', '', 'YES', 'NO', 'NO', 1, '', '', 'YES', 'NO', 1, 'YES', 'NO' ) ;

MySQL said: Documentation
#1136 - Column count doesn't match value count at row 1

I'm thinking it doesn't matter, just want to make sure. ;)
It does matter. Just tried with changing the values to ... something else ... and I still get the error message.
MySQL5.0.37, btw.
« Last Edit: November 28, 2008, 03:13:14 pm by Fred K (agentsmith) »
Logged

obiwan

  • Guest
Re: Extra Bug fix testing
« Reply #3 on: November 28, 2008, 03:28:58 pm »

Hi agentsmith,

it sounds to me, that your column count at the articles table (from installation)
differs to the patches applied from equilni's snippets.
Logged

centered

  • Guest
Re: Extra Bug fix testing
« Reply #4 on: November 28, 2008, 05:09:48 pm »

Does the first value matter? Cause I get this error:

Quote
Error

SQL query:

INSERT INTO `articles`
VALUES ( 2, 'Archive', 'archive', '[func]archive:|:0,200[/func]', NOW( ) , 0, 3, '', '', 'YES', 'NO', 'NO', 1, '', '', 'YES', 'NO', 1, 'YES', 'NO' ) ;

MySQL said: Documentation
#1136 - Column count doesn't match value count at row 1

I'm thinking it doesn't matter, just want to make sure. ;)
It does matter. Just tried with changing the values to ... something else ... and I still get the error message.
MySQL5.0.37, btw.

No it does not matter, I apologize, I should have noted that his is based off a fresh install, and no other articles would be posted other than the leading welcome article (id 1)
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: Extra Bug fix testing
« Reply #5 on: November 28, 2008, 06:20:16 pm »

np. Using a vanilla installation fixed it, yes. Except, I used the release 1.2 installation (with added sql for the Hide feature (I think?)) and this causes some additional problems. I will try with a vanilla vanilla installation, but just so you know about these issues in case anyone else comes across them.

Using 1.7 release 1.2, with its associated sql (1.7, not 1.6-1.7) and no further additions to the sql than what's required for this mod:

-- 1: Can't create new Pages.
-- 2: When changing the default Welcome article from an Article to a Page (just to test), this message appears:
Quote
Unknown column 'displaytags' in 'field list'
and the article remains an article of course.
I'm guessing that creating new Page makes the engine want to make a new entry in the db with id 2 (but, it's just a guess), which would conflict with the Archive page. Maybe?
« Last Edit: November 28, 2008, 07:41:57 pm by Fred K (agentsmith) »
Logged

centered

  • Guest
Re: Extra Bug fix testing
« Reply #6 on: November 28, 2008, 11:52:42 pm »

Hmm... displaytags is for the tag/keyword mod if I recall correctly
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: Extra Bug fix testing
« Reply #7 on: November 29, 2008, 02:30:48 am »

oh. yes, of course. good thing I tried that one though since I have the keywords mod in like every site... but the vanilla version, incl 1.2 is okay. good. just goes to show - order is important. ;)
the mod itself is grand, works great.
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: Extra Bug fix testing
« Reply #8 on: November 29, 2008, 04:12:53 am »

hmmm, why didn't you only fiddle with the case statements in extra() to get to expected behaviour??

anything else would be a pure expansion ie not a bug fix, but a mod.

Expected behaviour.
Assign to pages (all)
-- one would possibly expect that extra would display on hardcoded 'pages' since it is with the pages() function that they are displayed to user.
-- one would probably assume that it may also display when a user page is set to be 'home' in settings.


with limited testing, the following appears to operate: - changes only in function extra()
Quote
         // To show up on all pages only
         case (($category == -1||$category == -3) && $_catID == 0 && $getArt != $page && $page == 0):
            $print = true;
            break;
Logged
Of all the things I have lost, it is my mind that I miss the most.

centered

  • Guest
Re: Extra Bug fix testing
« Reply #9 on: November 29, 2008, 10:43:36 am »

anything else would be a pure expansion ie not a bug fix, but a mod.

Can you confirm this as a bug : http://snewscms.com/forum/index.php?topic=7995.0

Joost suggested another method that I am trying now - POSTED
« Last Edit: November 29, 2008, 11:09:50 am by equilni »
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: Extra Bug fix testing
« Reply #10 on: November 29, 2008, 12:24:18 pm »

http://snewscms.com/forum/index.php?topic=7996.msg56998#msg56998

when set to pages only (all),
extra shows on archive, sitemap etc.
extra shows on user page set as home

When set to pages (specific)
extra shows on specified user page
extra shows on user page set as home if it it the specified page

when set to all content
extra shows on all cats, articles, pages

when set to specific category,
extra shows on specified category (incl subcat)

when set to specific subcategory,
extra shows on specified subcategory

extra has never been selectable for 'hardcoded' pages only.
therefore, the fact that 1.7 also doesn't do this is not a bug.
Logged
Of all the things I have lost, it is my mind that I miss the most.

centered

  • Guest
Re: Extra Bug fix testing
« Reply #11 on: November 29, 2008, 02:19:12 pm »

extra has never been selectable for 'hardcoded' pages only.
therefore, the fact that 1.7 also doesn't do this is not a bug.

understood
« Last Edit: February 19, 2009, 05:31:20 am by equilni »
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: Extra Bug fix testing
« Reply #12 on: November 30, 2008, 02:30:41 am »

http://snewscms.com/user-guide/content/
Quote
The Pages drop-down lets you choose from any pages previously created.
that article goes on
Quote
Category drop-down lets you choose either Home or any other Category
but that is no longer possible when excluding Home as a category.
The effect can be replicated if a user page is set for home, and the extra set for that user page, but on a normal 'blog' home, setting a category for Home is not possible.
Logged
Of all the things I have lost, it is my mind that I miss the most.

centered

  • Guest
Re: Extra Bug fix testing
« Reply #13 on: February 19, 2009, 05:31:28 am »

extra has never been selectable for 'hardcoded' pages only.
therefore, the fact that 1.7 also doesn't do this is not a bug.

understood



Actually I retract this statement.  Just because the script didn't do it before, doesn't mean it should be swept away from maintaining full functionality. 
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: Extra Bug fix testing
« Reply #14 on: February 19, 2009, 04:42:07 pm »

Actually I retract this statement.  Just because the script didn't do it before, doesn't mean it should be swept away from maintaining full functionality. 
True, but it still doesn't make it a bug :) :)
Logged
Of all the things I have lost, it is my mind that I miss the most.
Pages: [1] 2