Ale nie! Kde je JavaScript?
Váš webový prehliadač nemá povolený JavaScript alebo nepodporuje JavaScript. Ak chcete správne zobraziť túto webovú lokalitu, povoľte JavaScript vo svojom webovom prehliadači, alebo inovujte na webový prehliadač, ktorý podporuje JavaScript.

Fórum

Related news panel PHP-Fusion 9

8 príspevkov
4183 zobrazení
Naposledy aktualizované pred 1 rokom
Z
Člen 67
Odoslané pred 3 rokmi
#1
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
Člen 293
Odoslané pred 3 rokmi
#2
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']."'>

Upravil/a Kvido dňa 21/09/2017 13:13, pred 3 rokmi
RobiNN
Hlavný administrátor 780
Odoslané pred 3 rokmi
#3
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();
 }
}

PHP-Fusion Development Manager
GitHub profil: GitHub
PHP Fusion témy: PF-Projects/PHP-Fusion-Themes
PHP Fusion infúzie: PF-Projects/PHP-Fusion-Infusions, php-fusion/Addons
Upravil/a RobiNN dňa 21/09/2017 18:00, pred 3 rokmi
Z
Člen 67
Odoslané pred 3 rokmi
#4
RobiNN! Thank you very much. Works good.
Z
Člen 67
Odoslané pred 1 rokom
#5
This panel does not work for me in Andromeda. What has changed in the code?
RobiNN
Hlavný administrátor 780
Odoslané pred 1 rokom
#6
Still works

snag.gy/K0dHkF.jpg
PHP-Fusion Development Manager
GitHub profil: GitHub
PHP Fusion témy: PF-Projects/PHP-Fusion-Themes
PHP Fusion infúzie: PF-Projects/PHP-Fusion-Infusions, php-fusion/Addons
Z
Člen 67
Odoslané pred 1 rokom
#7
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
Hlavný administrátor 780
Odoslané pred 1 rokom
#8
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
PHP-Fusion Development Manager
GitHub profil: GitHub
PHP Fusion témy: PF-Projects/PHP-Fusion-Themes
PHP Fusion infúzie: PF-Projects/PHP-Fusion-Infusions, php-fusion/Addons