Ach ne! Kde je JavaScript?
Váš webový prohlížeč nemá povolen JavaScript nebo nepodporuje JavaScript. Pro správné zobrazení tohoto webu nebo pro upgrade na webový prohlížeč, který podporuje JavaScript, povolte JavaScript ve webovém prohlížeči.
PHP-Fusion 9 Jádro
v9.03.00
Překlad CZ/SK
Pravidelně aktualizovaný
Demo
Testovat PHP-Fusion

Related news panel PHP-Fusion 9

Poslední aktualizace před 2 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.
Z
This panel does not work for me in Andromeda. What has changed in the code?
RobiNN
Z
In the Czechia theme, this panel works for you?
I insert the code on line 262 https://github.com/php-fusion/ci-News...s.php#L262 or on line 266 https://github.com/php-fusion/ci-News...s.php#L266, so that the panel is under the news.
For me, this panel works only in the themes Shadowness, Arise, Atom9, Bootstrap, Septenary and iTheme2. In all other templates, this panel does not work.

In the Shadowness theme, the video addon does not work yet. I received an error message
Fatal error: Uncaught ArgumentCountError: Too few arguments to function opentable(), 0 passed in C:\xampp\htdocs\lightxxcopy\infusions\videos\templates\videos.php on line 24 and at least 1 expected in C:\xampp\htdocs\lightxxcopy\themes\Shadowness\theme.php:540 Stack trace: #0 C:\xampp\htdocs\lightxxcopy\infusions\videos\templates\videos.php(24): opentable() #1 C:\xampp\htdocs\lightxxcopy\infusions\videos\videos.php(364): render_videos(Array) #2 {main} thrown in C:\xampp\htdocs\lightxxcopy\themes\Shadowness\theme.php on line 540
RobiNN
You must insert code to file.
Create new panel and enable it on panels administration. Folder name must be same as file name.
E.g.
Foldername: related_news_panel
Filename: related_news_panel.php
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 můž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
Farby uživateľov
v PHP-Fusion 9
117 0 xi3eat2
11-07-2019 20:16
upload vaccsich suborov
v Obecná diskuse
1144 4 rum
11-07-2019 07:45
Feedback
v PHP-Fusion 9
273 5 Balin50
22-06-2019 21:30
Administrácia adminov
v PHP-Fusion 9
228 1 RobiNN
22-06-2019 14:38
Súkromná správa
v Administrace obsahu
640 5 RobiNN
17-06-2019 17:14
Vodoznak
v Administrace obsahu
638 8 Balin50
31-05-2019 12:50
Related news panel PHP-Fusion 9
v PHP-Fusion 9
2396 7 RobiNN
28-05-2019 20:18