logo

PHP Fusion İçin İncelemelerden Alıntı Blok Kodu

logo

bu kodu PHP Fusion Mod Sitesinde bir üye için kodladım. kendisi rastgele seçilen bir incelemeden rastgele bir kısmı alıntı olarak göstertip oradan o incelemeye link veriyor.

kod da şu şekilde, sadece blok kodu ya da özel sayfa olarak eklemeleniz yeterli (blok kodunda taglarını silin tabi :) )

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
//Random Article Quotes 1.0
//by SoulSmasher
//http://www.soulsmasher.net
//this php file gets random content from article and shows as quote on a text which refers to URL of an article
$char=50; //how many minimum chars will be shown
$result = dbquery(
   "SELECT ta.article_id, ta.article_subject, ta.article_article, tac.article_cat_id, tac.article_cat_access FROM ".DB_ARTICLES." ta
   INNER JOIN ".DB_ARTICLE_CATS." tac ON ta.article_cat=tac.article_cat_id
   ".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0' ORDER BY rand() DESC LIMIT 1"
);
 
if(!dbrows($result)) {
openside("article not found");
echo "no article found";
closeside();
} else {
$data=dbarray($result);
$thearticle=stripslashes($data['article_article']);
$length=strlen(strip_tags($thearticle));
do {
$start=rand(0,$length);
} while(($start+$char)>$length);//we set our proper rand value here
$text=substr(strip_tags($thearticle),$start,$char); //html tags should be cleaned
openside("Random Article Quote");
echo "<a href='".BASEDIR."articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."' class='side'>$text</a>";
closeside();
}
?>

afiyet olsun :)

VN:F [1.9.3_1094]
Rating: 5.5/10 (2 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
PHP Fusion İçin İncelemelerden Alıntı Blok Kodu, 5.5 out of 10 based on 2 ratings
blog comments powered by Disqus
logo
logo
Powered by Wordpress | Designed by Elegant Themes