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 different readmore link for each category
Mfseker
Posted on 15 Jan 2010, 17:07:00

Access: Member
Total Posts: 6
Joined: 2009-12-03

this is my include style :
Code:

<?php 
$static 
= true;
$template = 'ortaalt';
$cat[] = 'analiz-audusd';
$cat[] = 'analiz-euraud';
$cat[] = 'News';
$nppage='6';
include 
'haber/index.php';
?> 


analiz-audusd's id is 4

i tried sth like that
Code:

if($row['short']){
  $str = str_replace("{shortstory}",bbcode($row['shortstory'],$usehtml),$str);
  $str = str_replace("{story}","",$str);
    if($row[catid]==4){
        [color=red]$_SESSION['prefix'] = '/analizler/';[/color]    }
        if($friendly){
                $str = str_replace("[readmore]","<a class=\"devam\" href=\"$_SESSION[prefix]$row[id]/" . makefriendly($row[title]) . "\">",$str);
            }else{
                $str = str_replace("[readmore]","<a class=\"devam\" href=\"?$linkprefix" . "id=$row[id]\">",$str);
            }


it didn't work. what can i do? how should i change $row[catid]==4 line?
#1541
Chris
Posted on 16 Jan 2010, 02:49:58

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

The problem is that there is no no field 'catid', articles that are assigned to categories have the id of the story and the id of the category stored in a different table. Not only that but articles can be assigned to more than one category so there may be multiple values you need to check against.

What you need to do is use the $current_cats array which already has all the categories the news article is assigned to. The way to check it to see if your news article is assigned to it you would do something like this

Code:
<?php
if(is_array($current_cats)){
    if(
in_array('3', $current_cats)){ // 3 is the id of your category
        //do something
    
}else{
        
//do something else
    
}
}
?>
#1547
Mfseker
Posted on 18 Jan 2010, 21:57:30

Access: Member
Total Posts: 6
Joined: 2009-12-03

hi chris,

now code is sth like that :

Code:
<?php 
        
if(is_array($current_cats)){
            if(
in_array('14', $current_cats)){ 
            
$_SESSION['prefix'] = '/analizler/';
    }else{
            
$_SESSION['prefix'] = '/haber/';
            } }
        if(
$friendly){
                
$str = str_replace("[readmore]","<a class=\"devam\" href=\"$_SESSION[prefix]$row[id]/" . makefriendly($row[title]) . "\">",$str);
            }else{
                
$str = str_replace("[readmore]","<a class=\"devam\" href=\"?$linkprefix" . "id=$row[id]\">",$str);
            }
            
$str = str_replace("[/readmore]","</a>",$str);            
?>


analiz-eurgbp's cat id is 14

and you can look "EURGBP: Gün İçi Yönelim Aşağı Doğru" News' "Devamını Oku" link. It is still /haber/ http://www.guncelforex.com/index2.php .

what should i do?
#1628
Chris
Posted on 18 Jan 2010, 22:02:26

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

the "EURGBP: Gün İçi Yönelim Aşağı Doğru" link goes to this url

http://www.guncelforex.com/analizler/82/0
#1629
Mfseker
Posted on 18 Jan 2010, 22:11:45

Access: Member
Total Posts: 6
Joined: 2009-12-03

no. not right side short titles.

i am working on in the middle part. you can see longer version in middle of the site - and it's link like /haber/82
#1630
Chris
Posted on 18 Jan 2010, 22:16:31

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

Ah yes I see the problem. There was a mistake in my original code, it should be like this

Code:
<?php
if(is_array($current_cats)){
    if(
in_array('analizler', $current_cats)){ // analizler is the name of the category
        //do something
    
}else{
        
//do something else
    
}
}
?>
#1631
Mfseker
Posted on 18 Jan 2010, 22:23:08

Access: Member
Total Posts: 6
Joined: 2009-12-03

i tried and it worked well...

thank you, again :)
#1632
Network-13.com © 2013