WebsiteBaker Community Forum

WebsiteBaker Support (2.13.x) => General Help & Support => Topic started by: bupaje on August 12, 2021, 11:44:17 PM

Title: most recent downloads and FAQ status
Post by: bupaje on August 12, 2021, 11:44:17 PM
Hi again. A couple quick questions.

1 - Does anyone have a snippet of code they use to grab most recent items added to the download folder? I want to list 5 or so most recent downloads to the sidebar of the home page.


2 - I did a search in the modules section and didn't see the FAQ module - is that one dead?

Thanks very much.
Title: Re: most recent downloads and FAQ status
Post by: dbs on August 13, 2021, 09:20:02 AM
Hi, for latest Downloads you can use this attached droplet.
Instal it via Admin-Tools > Droplets > Import Selected Drolet
and use then this call in html: [[latest-downloads?limit=5]]

or try the droplet code in a code or code2 section.
Code: [Select]
<?php //not this first line. only for colored code here

global $wb$database;
$header "<h3>Last Downloads</h3>";
$limit = ($limit)?:'3';  
$sort = isset($sort) ? $sort :'DESC'// DESC = Newest first

$sqlFiles 'SELECT * FROM `'.TABLE_PREFIX.'mod_download_galler y_files` WHERE `active` = 1 ORDER BY `modified_when` '.$sort.' LIMIT ' $limit;
$oRes $database->query($sqlFiles);

$html '<div id="last-downloads">' $header;

if (
$oFiles $database->query($sqlFiles)) {

$html .= '<ul>';
    while (
$aFiles $oRes->fetchRow(MYSQLI_ASSOC)) {
        
$changedatedate("d.m.y "$aFiles['modified_when']) . '<br />';
        
$title $aFiles['title'];
        
$desc "<br /><small>".$aFiles['description']."</small>";
        
//$root = $aFiles['root_parent'];
        
$weblink $aFiles['link'];
    
        
$html .=  "<li>"
              
.   $changedate
              
.   "<span><a title=\"Download: ".$title."\" href=\"".$weblink."\"> " $title " </a></span>"
              
$desc 
              
"</li>";
    }
$html .= '</ul>';
} else {
    
$html .= 'No results';
}
$html .= "</div>";

echo 
$html;
Title: Re: most recent downloads and FAQ status
Post by: hgs on August 13, 2021, 11:46:38 AM

2 - I did a search in the modules section and didn't see the FAQ module - is that one dead?

To 2

The module in version 2.0.0 is unfortunately no longer executable. (php8)
It throws the following error on a white page.
Therefore it is not released for download.
Code: [Select]
There was an uncatched exception
Call to a member function numRows() on null
in line (89) of (/modules/faqbaker/view.php)
php8 is written in the ErrorLog
Code: [Select]
Fri, 13 Aug 2021 05:37:38 +0000 [E_WARNING] /modules/faqbaker/view.php:[30]  from /framework/frontend.functions.php:[273] require "Undefined array key "header""
Fri, 13 Aug 2021 05:37:38 +0000 [E_WARNING] /modules/faqbaker/view.php:[31]  from /framework/frontend.functions.php:[273] require "Undefined array key "footer""
Fri, 13 Aug 2021 05:37:38 +0000 [E_WARNING] /modules/faqbaker/view.php:[32]  from /framework/frontend.functions.php:[273] require "Undefined array key "template_summary""
Fri, 13 Aug 2021 05:37:38 +0000 [E_WARNING] /modules/faqbaker/view.php:[33]  from /framework/frontend.functions.php:[273] require "Undefined array key "template_details""
Fri, 13 Aug 2021 05:37:38 +0000 [E_WARNING] /modules/faqbaker/view.php:[36]  from /framework/frontend.functions.php:[273] require "Undefined array key 1"


php7.4 is written in the ErrorLog
Code: [Select]
Fri, 13 Aug 2021 09:40:43 +0000 [E_WARNING] /modules/faqbaker/addon.php:[22]  from /modules/faqbaker/addon.php:[22] include "include(/www/htdocs/w01be3f2/WB_Testbereich/php7.4/WB_aktuell/modules/SimpleCommandDispatcher.inc): failed to open stream: No such file or directory"
Fri, 13 Aug 2021 09:40:43 +0000 [E_WARNING] /modules/faqbaker/addon.php:[22]  from /modules/faqbaker/addon.php:[22] include "include(): Failed opening '/www/htdocs/w01be3f2/WB_Testbereich/php7.4/WB_aktuell/modules/SimpleCommandDispatcher.inc' for inclusion (include_path='.:/usr/share/php:..')"



If someone can be found who wants to fix it, I can attach it here as zip.
Title: Re: most recent downloads and FAQ status
Post by: bupaje on August 13, 2021, 08:10:36 PM
Hi, for latest Downloads you can use this attached droplet.
Instal it via Admin-Tools > Droplets > Import Selected Drolet
and use then this call in html: [[latest-downloads?limit=5]]

or try the droplet code ...

Thank you dbs. The droplet returned nothing for me but the code in the code section works perfectly. I appreciate this very much.

Title: Re: most recent downloads and FAQ status
Post by: bupaje on August 13, 2021, 08:21:28 PM

2 - I did a search in the modules section and didn't see the FAQ module - is that one dead?

To 2

The module in version 2.0.0 is unfortunately no longer executable. (php8)
It throws the following error ...


2 - I did a search in the modules section and didn't see the FAQ module - is that one dead?

To 2

The module in version 2.0.0 is unfortunately no longer executable. (php8)...

Thank you very much hgs.
Title: Re: most recent downloads and FAQ status
Post by: bupaje on August 17, 2021, 01:13:20 AM
Hi, for latest Downloads you can use this attached droplet.
Instal it via Admin-Tools > Droplets > Import Selected Drolet
and use then this call in html: [[latest-downloads?limit=5]]

or try the droplet code in a code or code2 section.
Code: [Select]
<?php //not this first line. only for colored code here

global $wb$database;
$header "<h3>Last Downloads</h3>";
$limit = ($limit)?:'3';  
$sort = isset($sort) ? $sort :'DESC'// DESC = Newest first

$sqlFiles 'SELECT * FROM `'.TABLE_PREFIX.'mod_download_galler y_files` WHERE `active` = 1 ORDER BY `modified_when` '.$sort.' LIMIT ' $limit;
$oRes $database->query($sqlFiles);

$html '<div id="last-downloads">' $header;

if (
$oFiles $database->query($sqlFiles)) {

$html .= '<ul>';
    while (
$aFiles $oRes->fetchRow(MYSQLI_ASSOC)) {
        
$changedatedate("d.m.y "$aFiles['modified_when']) . '<br />';
        
$title $aFiles['title'];
        
$desc "<br /><small>".$aFiles['description']."</small>";
        
//$root = $aFiles['root_parent'];
        
$weblink $aFiles['link'];
    
        
$html .=  "<li>"
              
.   $changedate
              
.   "<span><a title=\"Download: ".$title."\" href=\"".$weblink."\"> " $title " </a></span>"
              
$desc 
              
"</li>";
    }
$html .= '</ul>';
} else {
    
$html .= 'No results';
}
$html .= "</div>";

echo 
$html;

Can I ask for a little more help? The download page is elsewhere. The latest news is on the home page. I guess I need to modify the code to ask for the id for the downloads page? I was getting some results as I placed another download in the sidebar of the home page initially but when I remove that one then the code you gave I guess is unaware of the location of the other download page. Thank you.
Title: Re: most recent downloads and FAQ status
Post by: bupaje on August 17, 2021, 01:17:40 AM
Arggghh. I goofed but found another error - I failed to remove a space when I tried to fix the following error. Now the news title and link shows but the link goes to a wrong page

https://www.mytestsite.com/download_gallery/5%20Gallon%20Door%20Restore%20Express%20-%20Square%20V3%20(Cardinal).pdf but the link on the downloads page that does work is

https://www.mytestsite.com/modules/download_gallery/dlc.php?id=0811A32

Thanks for any help.

Burt
Title: Re: most recent downloads and FAQ status
Post by: hgs on August 17, 2021, 07:52:20 AM
Unfortunately, we can't do anything with the linked pages.

Can you send us the correct links, gladly also as pm. Then we can possibly look a little more closely.
Title: Re: most recent downloads and FAQ status
Post by: bupaje on August 17, 2021, 05:47:16 PM
Thank you. I have PM'd you.
Title: Re: most recent downloads and FAQ status
Post by: dbs on August 18, 2021, 09:51:48 AM
Hello, i saw the link from your pn.

Your download links contains white spaces. This is not the way how DownloadGallery save new files.
What is your version of Download Gallery?
Title: Re: most recent downloads and FAQ status
Post by: bupaje on August 18, 2021, 05:18:10 PM
Hello, i saw the link from your pn.

Your download links contains white spaces. This is not the way how DownloadGallery save new files.
What is your version of Download Gallery?

3.0.6 - thought that was latest?
Title: Re: most recent downloads and FAQ status
Post by: dbs on August 18, 2021, 05:37:34 PM
I don't know something about your installation.
Was the files added via DonwloadGallery or via Media or via FTP?
The wihite spaces are the problem.
Title: Re: most recent downloads and FAQ status
Post by: bupaje on August 18, 2021, 09:10:30 PM
I don't know something about your installation.
Was the files added via DonwloadGallery or via Media or via FTP?
The white spaces are the problem.

Thanks I didn't realize. I think for now I will make slight modification to just list the files and put a link that takes people to download page to get file since that works. Once site is launched I will revisit this - the boss is in a hurry. I really appreciate your help. I will let you know when I start testing again.