Overriding functions/html_output.php
Zen Cart 1.3.8a
Database Patch Level: 1.3.8
Server OS: Linux 2.4.20PIII
PHP Version: 4.4.2 (Zend: 1.3.0)
Database: MySQL 4.1.19-standard
I would like to override the functions in the html_output.php file that output HTML tags.
Where do I put these functions, and what replacement structure do I need to use to remove / disregard the previously defined versions of these functions so I dont end up with PHP errors saying I duplicated something.
Re: Overriding functions/html_output.php
There is no in-built override system for files in the includes/functions folder, but I recentyly figured out a method to do it by utilizing the override capabilities within the autoload/init_includes system.
First, make a copy of includes/init_includes/init_general_functions.php and save it in the includes/init_includes/overrides/ folder. Then edit that file to modify the loading of the html_output.php file so that it calls the file from an overrides folder like:
Code:
require(DIR_WS_FUNCTIONS . 'overrides/html_output.php');
Then you can create your new folder includes/functions/overrides/, and put an edited copy of html_output in there. This way you can edit or add functions within html_output.php and not have to worry about duplicate functions warnings, or about your changes getting overwritten during an upgrade.
You can use a similar method for overriding anything in the functions or classes folders, which don't have an inherent override capability.
Re: Overriding functions/html_output.php
Awesome! Thank you! This is the perfect solution!
Re: Overriding functions/html_output.php
wow, it really helped me as well bunyip. I was looking into fixing the size of the header 2 banner regardless the size of the original image.
So I overrided banner.php and added two parameters to function zen_display_banner, width and height, both to be passed at the same time to zen_image, so that the image will be resized if needed.