Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    391
    Plugin Contributions
    0

    Default How to make admin plugin contribution show headers and footers.

    I am working on a plugin contribution for handling data feeds from admin.

    Using: Zencart 1.5.4 loaded via FTP 6 months ago, GoDaddy with the highest available version of PHP/MYSQL, and easypopulate and UPS are the only plugins I have installed. All sideboxes are disabled for my online catalog.

    Sorry, can't post the URL to my admin area for you to look at...

    How do I make the plugin wrap into the admin area with admin headers and footers showing? Are there any files I need to include or require to make sure security is maintained and error reporting works like it is supposed to?

    My plugin is PHP/PDO/MYSQL based...if that matters. Could the PDO db connection from my program be causing the headers and footers to disappear? The PDO connection is using the db connection info from Zencart admin/includes/configure.php I.E. -

    PHP Code:
    $XXXhostXXX DB_SERVER;
    $XXXuserXXX DB_SERVER_USERNAME;
    $XXXdbXXX DB_DATABASE;
    $XXXpassXXX DB_SERVER_PASSWORD
    I have successfully created a link in the admin/tools, the link opens my plugin, and my plugin is working through admin; however, it does not show up with the admin headers and footers.

    I have "required" application_top.php, application_bottom.php, application_footer, and copied the html document type through the end of the header tag from another plugin into my main plugin page. I know application_top.php is working because my db connection is coming through that one.

    I also completed many searches in the forums to try and find an answer but I can't find anything matching this issue. I have read the help file for creating and making a plugin contribution.

    Thanks.

    Mike Little
    Jest Country Stuff
    http://jestcountrystuff.com

  2. #2
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default Re: How to make admin plugin contribution show headers and footers.

    It's not just application_top that you need to include... Here's how I do admin pages:

    Code:
    <?php
    require_once('includes/application_top.php');
    ?>
    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html <?php echo HTML_PARAMS;?>>
    <head>
    	<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
    	<title>My Admin Page</title>
    	<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
    	<link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
        <link type="text/css" rel="stylesheet" href="css/style.css" />
    <?php include(DIR_WS_INCLUDES.'htmlarea.php'); ?>
    <script language="javascript" src="includes/menu.js"></script>
    <script language="javascript" src="includes/general.js"></script>
    <script type="text/javascript">
      <!--
      function init()
      {
        cssjsmenu('navbar');
        if (document.getElementById)
        {
          var kill = document.getElementById('hoverJS');
          kill.disabled = true;
        }
      }
      // -->
    </script>
    
    </head>
    <body onLoad="init()" >
    
    <!-- header //-->
    <?php require(DIR_WS_INCLUDES . 'header.php');
    require(DIR_WS_CLASSES . 'currencies.php');
    $currencies = new currencies();
    
    ?>
    <!-- header_eof //-->
    
    <?php
    
    // YOUR PHP CODE HERE
    
    ?>
    <!-- body //-->
    <table border="0" width="100%" cellspacing="2" cellpadding="2">
      <tr>
    <!-- body_text //-->
        <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
        
        YOUR HTML HERE
        
        </td>
        
    
    <!-- body_text_eof //-->
      </tr>
    </table>
    <!-- body_eof //-->
    
    <!-- footer //-->
    <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
    <!-- footer_eof //-->
    <br>
    </body>
    </html>
    <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
    It should work...

  3. #3
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    391
    Plugin Contributions
    0

    Default Re: How to make admin plugin contribution show headers and footers.

    ...and it did. Thanks for your help.

    A little more work on the layout and reporting and I should contribute soon.

    Thanks again.

  4. #4
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    391
    Plugin Contributions
    0

    Default Re: How to make admin plugin contribution show headers and footers.

    Ran into another issue...my admin plugin is timing out while I am actively using it.

    Is there some way to update the admin timer to stop this from happening?

    Also, when my plugin times out, it does not take me back to the login page...just a white screen. And, when I log back in, I have to refresh the page to get my plugin to show back up.

    How do I get it to go back to the admin login when it times out?

    How do I make the page refresh upon relogging in?

    Thanks.

  5. #5
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default Re: How to make admin plugin contribution show headers and footers.

    Almost impossible to say...

    First of all, a blank screen indicates a php parsing error - check your error logs. Next, is the plugin using AJAX? Are you sure you're using valid code? I've just had some similar problems with using AJAX in the admin and had to modify the code to get it working...

    If everything is working properly, you should not get kicked out, and if you do, it should trigger the standard Zen Cart functions to take you back to the page you originated from. So, I'm assuming you have some errors in your code...

  6. #6
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: How to make admin plugin contribution show headers and footers.

    Addtionally, is your plugin posting any data/have forms? If so, are you using the ZC form function of zen_draw_form such that the securitytoken is incorporated?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    391
    Plugin Contributions
    0

    Default Re: How to make admin plugin contribution show headers and footers.

    Quote Originally Posted by mc12345678 View Post
    Addtionally, is your plugin posting any data/have forms? If so, are you using the ZC form function of zen_draw_form such that the securitytoken is incorporated?
    I do have a form that for processing updates on my webstore. 8 dropdowns, 7 text inputs, and 5 different submits.

    I have not used the zen_draw form...probably the reason for the timeout.

    I am not sure how to implement the token...will have to look at some other plugins to see if I can figure it out. Is there an article that describes the implementation?

    My code actually uses the native zencart configure file to get db connection info. My db connection is done through a PDO and all of my code is PDO.

    Thanks for the insight!
    Last edited by mikeel100; 27 Oct 2015 at 09:17 PM. Reason: Form descriptions...

  8. #8
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: How to make admin plugin contribution show headers and footers.

    Quote Originally Posted by mikeel100 View Post
    I do have a form that for processing updates on my webstore. 8 dropdowns, 7 text inputs, and 5 different submits.

    I have not used the zen_draw form...probably the reason for the timeout.

    I am not sure how to implement the token...will have to look at some other plugins to see if I can figure it out. Is there an article that describes the implementation?

    My code actually uses the native zencart configure file to get db connection info. My db connection is done through a PDO and all of my code is PDO.

    Thanks for the insight!
    If you review the includes/functions/html_output.php file (or admin equivalent) and look at the zen_draw_form function, you will see that it self invokes the security token... So, kind of get a two birds with one stone effect if you use the ZC version (as well as never have to self code the form html again if that "format" were to ever change.) There is also the function zen_hide_session_id in the same file which is what you would want to invoke for hard coded forms that are using application_top, etc...
    Last edited by mc12345678; 27 Oct 2015 at 09:50 PM. Reason: missed a space.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: How to make admin plugin contribution show headers and footers.

    I also found ths post in the FAQ about forms and the security token... Somewhat an indirect route to understand, but there are many tools to discover this type of thing. The forum being one, comparing source code of a rendered page being another, looking at existng program code, etc... While somewhat "dated" there is also the docs available at http://zen-cart.com/docs. Look at the bottom of the list and will see there are links which nclude ZC 1.5.x... Not 100% accurate, but a great start for finding a ZC function that does the basic work for you.

    https://www.zen-cart.com/content.php...rying-to-login
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: How to make admin plugin contribution show headers and footers.

    Quote Originally Posted by mikeel100 View Post
    I do have a form that for processing updates on my webstore. 8 dropdowns, 7 text inputs, and 5 different submits.

    I have not used the zen_draw form...probably the reason for the timeout.

    I am not sure how to implement the token...will have to look at some other plugins to see if I can figure it out. Is there an article that describes the implementation?

    My code actually uses the native zencart configure file to get db connection info. My db connection is done through a PDO and all of my code is PDO.

    Thanks for the insight!
    Any reason why you are not using the Zen Cart functions and classes?

    Some examples: using the class query_factory (global instance stored in variable $db) for database connections, using the function bindVars (in class query_factory) to help sanitize / escape data going into the database, the functions in html_output.php such as zen_draw_form and zen_draw_input_field, etc?

    There are some slightly older phpdocs available in the first link posted by mc12345678. You can also generate your own from the Zen Cart 1.5.4 source code (or just search / review the source code). A good IDE should also provide you with autocomplete for all functions (with phpdoc references included) available in Zen Cart.

    As for examples, Zen Cart out-of-box includes a fair number of admin pages. These would be a good place to start looking to familiarize oneself with how Zen Cart admin pages are currently constructed (and commonly used code and functions).

    Another source of examples are other "plugins" available from this website. If you are looking for admin pages specifically, just select "admin tools" from the list and pick one of the plugins designed for the same version of Zen Cart as you are using / targeting.
    Last edited by lhungil; 27 Oct 2015 at 10:30 PM.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v154 Adding a new Plugin/Contribution, how can we add screenshots?
    By grebenarov in forum Contribution-Writing Guidelines
    Replies: 1
    Last Post: 7 Jul 2015, 07:51 AM
  2. Replies: 3
    Last Post: 21 Feb 2013, 01:36 PM
  3. Newsletter e-mail headers/footers?
    By Glock1 in forum General Questions
    Replies: 2
    Last Post: 6 Jan 2012, 01:52 PM
  4. How to make processed orders to show as shipped in admin panel?
    By SandraSD in forum Managing Customers and Orders
    Replies: 7
    Last Post: 25 Feb 2010, 12:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg