If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / Overriding functions/html_output.php

Overriding functions/html_output.php

Locked

Started by kokuryu on 27 Feb 2009, 5:40 PM · Views: 3,796

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
27 Feb 2009, 5:40 PM
#1
kokuryu avatar

kokuryu

New Zenner

Join Date:
Feb 2009
Posts:
4
Plugin Contributions:
0

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.

27 Feb 2009, 6:07 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

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:

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.

Neville
An assumption is what you arrive at when you get tired of thinking...

27 Feb 2009, 7:23 PM
#3
kokuryu avatar

kokuryu

New Zenner

Join Date:
Feb 2009
Posts:
4
Plugin Contributions:
0

Re: Overriding functions/html_output.php

Awesome! Thank you! This is the perfect solution!

16 Mar 2009, 7:02 PM
#4
calixto avatar

calixto

New Zenner

Join Date:
Mar 2009
Posts:
30
Plugin Contributions:
0

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.

17 Apr 2010, 12:19 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,140
Plugin Contributions:
56

Re: Overriding functions/html_output.php

Thanks for this! I was looking for the usage of the init_includes/overrides folder ... and here it is.