PHP min. 5.6.8MySQL min. 5.1Apache min. 2.0
PHP-Fusion 9 Jádro
v9.0
Český překlad
Pravidelně aktualizovaný

Related news panel PHP-Fusion 9

Poslední aktualizace před 10 měsíci
Z
Help me remake the Pf-7 panel, to work on Pf-9. I have on my old site a panel that shows the related news by title. This panel does not want to work in Pf-9.
The working code of the pf-7 panel. I paste it into the file news.php
//---***Start related news***---//
if ((FUSION_SELF == 'news.php') && isset($_GET['readmore']) && isNum($_GET['readmore']))
 {
 list($news_subject) = dbarraynum(dbquery("SELECT news_subject from ".DB_NEWS." WHERE news_id=".$_GET['readmore']));
 
 $rel_news_res = dbquery("SELECT news_id, news_subject, news_news, news_image FROM ".DB_NEWS." WHERE MATCH (news_subject) AGAINST ('".$news_subject."' IN BOOLEAN MODE) AND news_id != ".$_GET['readmore']." ORDER BY news_datestamp DESC LIMIT 10");

$langPanel['001'] = "Related news:";
$counter = 0;
$columns = 2; //number of columns per line
 
 if(dbrows($rel_news_res))
 {
 opentable($langPanel['001']);
 echo "<table width='100%'>\n<tr>\n";
 while($news = dbarray($rel_news_res))
 {
 if ($counter != 0 && ($counter % $columns == 0)) // close if you want to display in one line
echo "</tr>\n<tr>\n";
 echo "<td width='50%'>\n";
echo "<table cellpadding='4' cellspacing='2' width='100%'>\n<tr>\n";
 echo "<td><a href='".BASEDIR."news.php?readmore=".$news['news_id']."' alt='".$news['news_subject']."'><img src='".IMAGES_N."".$news['news_image']."' title='".$news['news_subject']."' align='left' width='100%' height='auto' /></a><br /><strong><a href='".BASEDIR."news.php?readmore=".$news['news_id']."'>".trimlink(strip_tags(stripslashes($news['news_subject'])), 39)."</a></strong></br>".trimlink(strip_tags(stripslashes($news['news_news'])), 69)."</td>\n</tr>\n";
 echo "</table>\n</td>\n";
 $counter++; // close if you want to display in one line
   }
 echo "</tr>\n</table>\n";
 closetable();
 }
 }
//---***End***---//

For testing in Pf-9, I inserted this code into the file ..infusions \ news \ templates \ news.php. I tried to change the BASEDIR on INFUSIONS."news/   - this is not enough, I need to edit somewhere else, but I do not know. Help who can.
Kvido
I think the code must be INFUSIONS through which news is also in v.9. In v.7 it was in the root directory ...
So maybe this way:

Place:
echo "<td> <a href='" BASEDIR."news.php?readmore=".$news['news_id']."' alt ='".$news['news_subject']."'>


Change to
<a class='text-white' href='".INFUSIONS."news/news.php?readmore=".$news_item['news_id']."'>
RobiNN
Now works on PF9

if ((FUSION_SELF == 'news.php') && isset($_GET['readmore']) && isnum($_GET['readmore'])) {
 list($news_subject) = dbarraynum(dbquery("SELECT news_subject from ".DB_NEWS." WHERE news_id=:news_id", [':news_id' => $_GET['readmore']]));

 $rel_news_res = dbquery("SELECT n.news_id, n.news_subject, n.news_news, i.news_image
 FROM ".DB_NEWS." AS n
 LEFT JOIN ".DB_NEWS_IMAGES." AS i ON n.news_id = i.news_id
 WHERE MATCH (n.news_subject) AGAINST ('".$news_subject."' IN BOOLEAN MODE) AND n.news_id != :news_id
 ORDER BY n.news_datestamp DESC LIMIT 10
 ", [':news_id' => $_GET['readmore']]);

 $langPanel['001'] = "Related news:";
 $counter = 0;
 $columns = 2; // number of columns per line

 if (dbrows($rel_news_res)) {
 opentable($langPanel['001']);
 echo "<table width='100%'>\n<tr>\n";
 while ($news = dbarray($rel_news_res)) {
 if ($counter != 0 && ($counter % $columns == 0)) // close if you want to display in one line
 echo "</tr>\n<tr>\n";
 echo "<td width='50%'>\n";
 echo "<table cellpadding='4' cellspacing='2' width='100%'>\n<tr>\n";
 echo "<td>";
 if (!empty($news['news_image'])) {
 echo "<a href='".INFUSIONS."news/news.php?readmore=".$news['news_id']."' title='".$news['news_subject']."'>";
 echo "<img src='".IMAGES_N.$news['news_image']."' alt='".$news['news_subject']."' align='left' width='100%' height='auto' />";
 echo "</a>";
 }
 echo "<strong><a href='".INFUSIONS."news/news.php?readmore=".$news['news_id']."'>".trimlink(strip_tags(stripslashes($news['news_subject'])), 39)."</a></strong>";
 echo "</br>".trimlink(strip_tags(stripslashes($news['news_news'])), 69)."</td>\n</tr>\n";
 echo "</table>\n</td>\n";

 $counter++; // close if you want to display in one line
 }
 echo "</tr>\n</table>\n";
 closetable();
 }
}
Z
RobiNN! Thank you very much. Works good.
Vy můžete zobrazit všechny příspěvky v tomto fóru.
Vy nemůžete začít nový diskusní příspěvek v tomto fóru.
Vy nemůžete odpovědět v této diskusi.
Vy nemůžete začít v anketu v tomto fóru.
Vy nemůžete na tomto fóru nahrát přílohy.
Vy nemůžete stáhnout přílohy v tomto fóru.
Uživatelé, kteří se účastnili diskuse:Kvido, RobiNN, zizub
Nejnovější témata fóra
  Vlákno Zobrazení Odpovědi Poslední příspěvek
Novinky [Vyřešeno]
v Bugy a chyby
34 3 Balin50
19-07-2018 15:35
upgrade z 7.00.05 na 7.02.07
v PHP-Fusion 7
64 13 jany
19-07-2018 07:06
zoznam užívateľov
v Administrace uživatelů
32 4 Balin50
18-07-2018 21:06
Nápady - podnety
v Obecná diskuse
50 3 RobiNN
18-07-2018 18:13
video [Vyřešeno]
v Infuze, panely, vzhledy
37 5 RobiNN
17-07-2018 16:17
zvlastny bug [Vyřešeno]
v PHP-Fusion 9.0
358 39 RobiNN
16-07-2018 17:52