Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Help & Support Problem
Nevil
Posted on 22 Jun 2010, 13:24:20

Access: Member
Total Posts: 32
Joined: 2010-01-08

Hy, after having install the 3.6 version, a problem appears. The menu with links to each sub sections doesn't work now.

http://nevil.fr/nevil-blog-accueil.php

How can i solve this,

thanks


Névil
#2527
Nevil
Posted on 22 Jun 2010, 14:28:22

Access: Member
Total Posts: 32
Joined: 2010-01-08

I add an element, apparently the problem is in the lines to make appear the numbers of articles in each categories:

Code:
<?php 
        
require_once 'news/db.php';
        require_once 
'news/config.php';
        
        
$catname = 'Longs-Metrages'; #name of the category you want to count the articles for
        
        
$articlecount = DataAccess::fetch("SELECT COUNT(uid) AS totalarticles FROM $newsgroupcats INNER JOIN $newscats ON $newsgroupcats.catid = $newscats.id WHERE $newscats.name = ? AND $newsgroupcats.type = ?", $catname, "news");
        
        
$articlecount = $articlecount['0']['totalarticles'];
        
        echo 
$articlecount;
    
?>


The error seems to be in this line precisely:
Code:
<?php 
$articlecount 
= DataAccess::fetch("SELECT COUNT(uid) AS totalarticles FROM $newsgroupcats INNER JOIN $newscats ON $newsgroupcats.catid = $newscats.id WHERE $newscats.name = ? AND $newsgroupcats.type = ?", $catname, "news");
?>


The script show an error but i erase this line in the actual page of my blog (that's why no error appears in the link i gave you before).

Thanks for your solution.

Névil
#2528
Chris
Posted on 22 Jun 2010, 19:01:21

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

Try this instead

Code:
<?php 
    
....
        
$articlecount = DataAccess::fetch("SELECT COUNT(uid) AS totalarticles FROM " . NEWS_GROUPCATS . " INNER JOIN " . NEWS_CATS . " ON " . NEWS_GROUPCATS . ".catid = " . NEWS_CATS . ".id WHERE " . NEWS_CATS . ".name = ? AND " . NEWS_GROUPCATS . ".type = ?", $catname, "news");
    ....
    
?>
#2529
Nevil
Posted on 22 Jun 2010, 20:08:41

Access: Member
Total Posts: 32
Joined: 2010-01-08

Thanks a lot, it works perfectly as always.

I have an old question with no answer yet:
From a sub-section of the blog with several pages, when we want to go to the page two of the sub-section, clicking on page 2 send us to the page two of the general section, and not to page 2 of the sub-section.

Is there a solution to that problem or not ?

thanks for all your great work !

Névil

#2530
Chris
Posted on 22 Jun 2010, 20:20:45

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

It's possible to fix that by editing a file and using a bit of custom code, edit index.php, around line 468~ you'll see this chunk of code

Code:
    $amounttoshow = $nppage;
    $amountofpages = ceil($totalnews / $amounttoshow);                    
    if(!$page){         
        $start = 0;
        $page = 1;
    }else{
        if(!is_numeric($page)){
            $page = 1;
        }
        if($page > $amountofpages){
            $start = 0;
            $page = 1;    
        }else{                                
            $start = $page * $amounttoshow - $amounttoshow;
        }    
    }


Just below that add this

Code:
    if($static == "true"){
        $start = 0;
    }


Now on the page where you have the multiple includes /sub sections code them like so

Include 1

Code:
<?php
$linkprefix 
= "sub=1&";
if(
$_GET['sub'] !== "1"){
    
$static = true;
}
//any other variables here like $cat[]
include 'news/index.php';
?>


Include 2

Code:
<?php
$linkprefix 
= "sub=2&";
if(
$_GET['sub'] !== "2"){
    
$static = true;
}
//any other variables here like $cat[]
include 'news/index.php';
?>
#2531
Nevil
Posted on 22 Jun 2010, 22:48:29

Access: Member
Total Posts: 32
Joined: 2010-01-08

Thanks for your answer.
I am not sure i've done well.

After including new code in index.php of the "news" folder

I've replace this lines:

Code:

<?php
$cat 
= array();
$cat[] = $_GET['cat']; #grab the category from the url
$image_maxwidth = '500'; 
$image_maxheight = '600'; 
$linkprefix = 'color=BDBDBD';
include 
'news/index.php';
?> 


by this lines:

Code:
<?php
$linkprefix 
= "sub=1&";
if(
$_GET['sub'] !== "1"){
    
$static = true;
}
$cat = array();
$cat[] = $_GET['cat']; #grab the category from the url
$image_maxwidth = '500'; 
$image_maxheight = '600'; 
$linkprefix = 'color=BDBDBD';
include 
'news/index.php';
?> 

<?php
$linkprefix 
= "sub=2&";
if(
$_GET['sub'] !== "2"){
    
$static = true;
}
$cat = array();
$cat[] = $_GET['cat']; #grab the category from the url
$image_maxwidth = '500'; 
$image_maxheight = '600'; 
$linkprefix = 'color=BDBDBD';
include 
'news/index.php';
?> 


It doesn't solve the problem in fact that include twice the articles in each page of the blog
but i probably didn't do well...

Névil
#2532
Last edited by Nevil at 2010-06-22 22:51:41 Reason:
Chris
Posted on 22 Jun 2010, 22:52:34

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

Code:
$linkprefix = 'color=BDBDBD';


Delete the 2 instances of this
#2533
Nevil
Posted on 22 Jun 2010, 22:58:56

Access: Member
Total Posts: 32
Joined: 2010-01-08

It doesn't solve the problem neither
That always includes twice the articles in each page of the blog.

#2534
Chris
Posted on 22 Jun 2010, 23:07:17

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

It worked for me

http://dev.network-13.com/testinclude.php
#2535
Nevil
Posted on 22 Jun 2010, 23:17:46

Access: Member
Total Posts: 32
Joined: 2010-01-08

thank you for your time, i'll try this solution again.

#2536
Network-13.com © 2013