[Mini Mod] Önceki Makale Sonraki Makale Bildirimi

[Mini Mod] Önceki Makale Sonraki Makale Bildirimi

Ziyaretçilerinize okuduğu makaleden önce ve sonra hangi makalenin geldiğini göstermek istiyorsanız bu mod tam size göre...
İlk olarak dil dosyasına şu kodları ekleyiniz:
#fast links
$l['previous_article'] = 'Önceki Makale: ';
$l['next_article'] = 'Sonraki Makale: ';
Daha sonra snews.php de şunu bulunuz:
// ARTICLES
function articles() {
Hemen üstüne şu kodları ekleyiniz:
//Version3
functionfast_links(){
global$_ID,$_catID;
if(!$_ID)return;
if(!$_catID)return;
$vis=!_ADMIN?'ANDa.visible='YES'':'';
$query='
(SELECT
"'.l('previous_article').'"asltext,
a.title,a.seftitleASasef,
c.seftitleAScsef,
x.seftitleASxsef
FROM'._PRE.'articlesASa
LEFTOUTERJOIN'._PRE.'categoriesasc
ONa.category=c.id
LEFTOUTERJOIN'._PRE.'categoriesasx
ON(c.subcat=x.id
ANDx.published="YES")
WHEREposition=1
ANDa.published=1
ANDa.category='.$_catID.'
ANDc.published="YES"
'.$vis.'
AND(
CASE
WHENa.artorder=(SELECTartorderFROM'._PRE.'articlesWHEREid='.$_ID.')
THENa.date>(SELECTdateFROM'._PRE.'articlesWHEREid='.$_ID.')
ELSEa.artorder<(SELECTartorderFROM'._PRE.'articlesWHEREid='.$_ID.')
END
)
ORDERBYartorderDESC,dateASC
LIMIT1) 
UNION
(SELECT
"'.l('next_article').'"asltext, 
a.title,a.seftitleASasef,
c.seftitleAScsef,
x.seftitleASxsef
FROM'._PRE.'articlesASa
LEFTOUTERJOIN'._PRE.'categoriesasc
ONa.category=c.id
LEFTOUTERJOIN'._PRE.'categoriesasx
ON(c.subcat=x.id
ANDx.published="YES")
WHEREposition=1
ANDa.published=1
ANDa.category='.$_catID.' 
ANDc.published="YES"
AND(
CASE
WHENa.artorder=(SELECTartorderFROM'._PRE.'articlesWHEREid='.$_ID.')
THENa.date<(SELECTdateFROM'._PRE.'articlesWHEREid='.$_ID.')
ELSEa.artorder>(SELECTartorderFROM'._PRE.'articlesWHEREid='.$_ID.')
END
)
'.$vis.' 

ORDERBYartorderASC,dateDESC 
LIMIT1)
';
$result=mysql_query($query);
if(!$result||!mysql_num_rows($result))return;
else{
echo'<divid="fast_links">';
while($r=mysql_fetch_assoc($result)){
$r['xsef']=is_null($r['xsef'])?'':$r['xsef'].'/';
echo'<p>'.$r['ltext'].'
<ahref="'._SITE.$r['xsef'].$r['csef'].'/'.$r['asef'].'/"title="'.$r['title'].'">'.$r['title'].'</a> 
</p>'; 
}
echo'</div>';
}
}

/*Version2
functionfast_links(){
global$_ID,$_catID;
if(!$_ID)return;
if(!$_catID)return;
$vis=!_ADMIN?'ANDa.visible='YES'':'';
$query='
(SELECT
"'.l('previous_article').'"asltext,
a.title,a.seftitleASasef,
c.seftitleAScsef,
x.seftitleASxsef
FROM'._PRE.'articlesASa
LEFTOUTERJOIN'._PRE.'categoriesasc
ON'._PRE.'category=c.id
LEFTOUTERJOIN'._PRE.'categoriesasx
ONc.subcat=x.id
ANDx.published="YES"
WHEREposition=1
ANDa.published=1
ANDa.category='.$_catID.'
ANDc.published="YES"
AND(a.id<'.$_ID.'ANDa.id>=1)
'.$vis.'
ORDERBYa.idDESC 
LIMIT1) 
UNION
(SELECT
"'.l('next_article').'"asltext, 
a.title,a.seftitleASasef,
c.seftitleAScsef,
x.seftitleASxsef
FROM'._PRE.'articlesASa
LEFTOUTERJOIN'._PRE.'categoriesasc
ONcategory=c.id
LEFTOUTERJOIN'._PRE.'categoriesasx
ONc.subcat=x.id
ANDx.published="YES"
WHEREposition=1
ANDa.published=1
ANDa.category='.$_catID.' 
ANDc.published="YES"
AND(a.id>'.$_ID.'ANDa.id<(SELECTMAX(id)FROM'._PRE.'articles))
'.$vis.' 
ORDERBYa.idASC 
LIMIT1)
';
$result=mysql_query($query);
if(!$result||!mysql_num_rows($result))return;
else{
echo'<divid="fast_links">';
while($r=mysql_fetch_assoc($result)){
$r['xsef']=is_null($r['xsef'])?'':$r['xsef'].'/';
echo'<p>'.$r['ltext'].'
<ahref="'._SITE.$r['xsef'].$r['csef'].'/'.$r['asef'].'/"title="'.$r['title'].'">'.$r['title'].'</a> 
</p>'; 
}
echo'</div>';
}
}
*/

//version1-don'tuse
/*
functionfast_links(){
global$_ID,$_catID;
if(!$_ID)return;
if(!$_catID)return;
$query='
SELECT
"'.l('previous_article').'"asltext,
a.title,a.seftitleASasef,
c.seftitleAScsef,
x.seftitleASxsef
FROMarticlesASa
LEFTOUTERJOINcategoriesasc
ONcategory=c.id
LEFTOUTERJOINcategoriesasx
ONc.subcat=x.id
ANDx.published="YES"
WHEREposition=1
ANDa.published=1
ANDa.category='.$_catID.'
ANDc.published="YES"
ANDa.id=('.$_ID.'-1)
LIMIT2 
UNION
SELECT
"'.l('next_article').'"asltext, 
a.title,a.seftitleASasef,
c.seftitleAScsef,
x.seftitleASxsef
FROMarticlesASa
LEFTOUTERJOINcategoriesasc
ONcategory=c.id
LEFTOUTERJOINcategoriesasx
ONc.subcat=x.id
ANDx.published="YES"
WHEREposition=1
ANDa.published=1
ANDa.category='.$_catID.' 
ANDc.published="YES"
ANDa.id=('.$_ID.'+1)
LIMIT2';
$result=mysql_query($query);
if(!$result||!mysql_num_rows($result))return;
else{
echo'<divid="fast_links">';
while($r=mysql_fetch_assoc($result)){
$r['xsef']=is_null($r['xsef'])?'':$r['xsef'].'/';
echo'<p>'.$r['ltext'].'
<ahref="'._SITE.$r['xsef'].$r['csef'].'/'.$r['asef'].'/"title="'.$r['title'].'">'.$r['title'].'</a> 
</p>'; 
}
echo'</div>';
}
}
*/
Daha sonra snews.php de şu kodu bulunuz:
$infoline = $r['displayinfo'] == 'YES' ? true : false;
Hemen altına şu kodu ekleyiniz:
$last = empty($last) ? $r['aid'] : $last;
$first = $r['aid'];