• Welcome to WebsiteBaker Community Forum. Please log in or sign up.
Welcome, Guest
News
Support WebsiteBaker
Your donations will help to:
PayPal
  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!
You can donate by clicking on the button below.

most recent downloads and FAQ status

Started by bupaje, August 12, 2021, 11:44:17 PM  ( Read 22,962 times )

bupaje

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.

    dbs

    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.<?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)) {
           
    $changedate= date("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;

      hgs

      #2
      Quote from: bupaje on August 12, 2021, 11:44:17 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 on a white page.
      Therefore it is not released for download.
      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
      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
      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.
        LG Harald

        "Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

        "Never begin to stop - never stop beginning." Marcus Tullius Cicero (106-43 BC)

        bupaje

        Quote from: 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 ...

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


          bupaje

          Quote from: hgs on August 13, 2021, 11:46:38 AM
          Quote from: bupaje on August 12, 2021, 11:44:17 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 ...

          Quote from: hgs on August 13, 2021, 11:46:38 AM
          Quote from: bupaje on August 12, 2021, 11:44:17 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)...

          Thank you very much hgs.

            bupaje

            #5
            Quote from: 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.<?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)) {
                   
            $changedate= date("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.

              bupaje

              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

                hgs

                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.
                  LG Harald

                  "Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

                  "Never begin to stop - never stop beginning." Marcus Tullius Cicero (106-43 BC)

                  bupaje


                  dbs

                  #9
                  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?

                    bupaje

                    Quote from: 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?

                    3.0.6 - thought that was latest?

                      dbs

                      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.

                        bupaje

                        Quote from: 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 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.

                          \n\n