Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jan 2004
    Posts
    38
    Plugin Contributions
    0

    Default Need to override functions_general.php

    I need to make a minor change to includes/functions/functions_general.php. Is there a way proper way to override this file, or to override a function that is in this file?

    Thanks ... Lucy

  2. #2
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: Need to override functions_general.php

    What are you trying to do?
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  3. #3
    Join Date
    Jan 2004
    Posts
    38
    Plugin Contributions
    0

    Default Re: Need to override functions_general.php

    I need to modify zen_clean_html ... reasons are complicated ... is there a way to override just that function so that future updates to Zen won't wipe my mods out?

  4. #4
    Join Date
    Mar 2008
    Posts
    1
    Plugin Contributions
    0

    Idea or Suggestion Re: Need to override functions_general.php

    Hallo,

    it is possible to do this by overriding the file 'includes/init_includes/overrides/init_general_funcs.php'. This file does the require-statements for the general functions from 'includes/functions':
    PHP Code:
    require(DIR_WS_FUNCTIONS 'functions_general.php');
    require(
    DIR_WS_FUNCTIONS 'html_output.php');
    require(
    DIR_WS_FUNCTIONS 'functions_email.php');
    require(
    DIR_WS_FUNCTIONS 'functions_ezpages.php');
    include(
    DIR_WS_MODULES 'extra_functions.php'); 
    In the override-file, just put something like:
    PHP Code:
    if (file_exists(DIR_WS_FUNCTIONS $s_overrides 'functions_general.php')) {
        
    // if override-file exists, use instead of the original file
        
    require(DIR_WS_FUNCTIONS $s_overrides 'functions_general.php');
    } else {
        require(
    DIR_WS_FUNCTIONS 'functions_general.php');

    instead of the simple require statement.
    (An example 'init_general_funcs.php' is attached, where the name of the override-folder for the functions is choosen to be 'overrides').

    Now it is possible to override one of the following files by putting your own version into the 'includes/functions/overrides'-folder:
    - functions_general.php
    - html_output.php
    - functions_email.php
    - functions_ezpages.php

    Since the overriding of the files from 'includes/functions' is not complete (not all files are overridable, but just a few of them), I strongly advise to put a readme-file into the new overrides-folder, that explains about this (see example attached: readme.txt).

    And remember to merge all files inside the overrides-folders (all of them) after upgrades

    greets

    jipjip

    edit:
    it is possible that you need to override the "includes/modules/payment/paypal/ipn_application_top.php"-file, too. You have to decide for yourself, if this file a) is used at all, b) does need the original version or the overriden version of the general functions. That is because the file does the require on it's own instead of using the init_includes.
    Attached Files Attached Files
    Last edited by Jipjip; 28 Mar 2008 at 11:59 AM. Reason: additional info

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,532
    Plugin Contributions
    127

    Default Re: Need to override functions_general.php

    Quote Originally Posted by lbowenc View Post
    I need to modify zen_clean_html ... reasons are complicated ... is there a way to override just that function so that future updates to Zen won't wipe my mods out?
    When I do something like this, I always rename the file from the distro to "<filename>.orig" - so that way when it's time to upgrade I can just search for "*.orig" files and have a list of things I need to customize after the install.

    Good luck,
    Scott
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. Need some help diagnosing functions_general,php errors
    By philip937 in forum General Questions
    Replies: 28
    Last Post: 22 Feb 2013, 07:35 PM
  2. Replies: 1
    Last Post: 11 Jul 2009, 07:11 PM
  3. Need to display Product ID in functions_general.php to edit Category List Showcase
    By vandiermen in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 9 Mar 2009, 03:25 AM
  4. Replies: 2
    Last Post: 17 Aug 2007, 08:19 AM
  5. Does Configure.php need to be saved as override?
    By mlm2005 in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 4 Jul 2006, 04:33 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