Admin HEAD content

New standards for head element in admin files

Starting in Zen Cart 1.5.7, a new file admin/includes/admin_html_head.php was introduced to consolidate the code required to build the <head> element in an admin page. This includes such things as:

  • setting the page title
  • pulling in stylesheets
  • including any needed javascript

In prior versions, the code to do this was replicated on each admin page.

Since then, admin pages have updated over time to remove the replicated blocks of code in favor of a single inclusion of admin_html_head.php. As of Zen Cart 2.0.0, this change is complete, and older files used by the old method have been deprecated. This includes:

  • admin/includes/menu.css
  • admin/includes/menu.js
  • admin/includes/stylesheet.css

Some older plugins may still use these files. Migrating to the new standard is straightforward; simply replace the old contents of the <head> element by a reference to admin_html_head.php.

Admin HTML Header change example 1

Admin HTML Header change example 2

You will also want to remove references to the old init() javascript function.

Admin HTML Header change example 3

If you maintain a plugin which needs to work on both older and newer versions of Zen Cart simultaneously, see the Email Archive Manager plugin, which does this.

Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified April 4, 2024 by Scott Wilson (245c76f).