Widget Help - Shows Grayed Out On Dashboard (PHP)

Discussion in 'Customization & add-ons' started by specialk77, Sep 28, 2020.

  1. specialk77

    specialk77 New Member

    Joined:
    Sep 28, 2020
    Messages:
    1
    Hello,

    I have a widget.php file located in the application\default\views\admin\widget\ directory.

    I can see the widget on my Dashboard. I am trying to include another PHP class file to grab data but when I add this the widget on the Dashboard shows as grayed out. If I comment out the require_once and data function lines the widget shows fine.

    I can execute the widget.php code from the command line and it gives no errors (except for the aMember functions).

    What am I doing wrong here?

    PHP:
    <?php
       
        $automation_library_path 
    "/path/to/require/file/";

        require_once 
    $automation_library_path "KeyValue.php";

        
    $key_value = new KeyValue();

        
    $total $key_value->get("stats_total");
        
    $available $key_value->get("stats_available");

     
    ?>

    <div class="admin-last">
        <h2><?php __e('Statistics'5); ?></h2>
        <div class="am-grid-container">
            <table class="am-grid grid-no-highlight">

                        <tr class="am-grid-row">
                    <td><div style="padding-bottom:.4em">
    Total Licenses In Portal: <?php echo $total?><br/>
    Idle Licenses (Available): <?php echo $available?><br/>

                        </div>

                    </td>
                </tr>
              
            </table>
        </div>
    </div>
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Hello,

    You need to check php error log to find what cause this error. I do not see anything wrong in template but I do not know what you have in 3rt party file and how you use this template.

    Also you can enable debug mode in aMember to see actual error messages instead of generic one:
    https://docs.amember.com/docs/Frequently_Asked_Questions#how-to-enable-more-verbose-error-messages

    Please note that aMember load these widgets with AJAX so you need to check network response in browser developer console to see error.

    Best Regards.

Share This Page